Part Number Hot Search : 
N6105 AP3P090N S0212 MP1470 SQ9910 GSIB420 BA4236L KK4011B
Product Description
Full Text Search
 

To Download HD6417708 Datasheet File

  If you can't view the Datasheet, Please click here to try to view without PDF Reader .  
 
 


  Datasheet File OCR Text:
  sh7708 series sh7708, sh7708s, sh7708r hardware manual ade-602-105e rev.6.0 5/5/99 hitachi, ltd.
cautions 1. hitachi neither warrants nor grants licenses of any rights of hitachi? or any third party? patent, copyright, trademark, or other intellectual property rights for information contained in this document. hitachi bears no responsibility for problems that may arise with third party? rights, including intellectual property rights, in connection with use of the information contained in this document. 2. products and product specifications may be subject to change without notice. confirm that you have received the latest product standards or specifications before final design, purchase or use. 3. hitachi makes every attempt to ensure that its products are of high quality and reliability. however, contact hitachi? sales office before using the product in an application that demands especially high quality and reliability or where its failure or malfunction may directly threaten human life or cause risk of bodily injury, such as aerospace, aeronautics, nuclear power, combustion control, transportation, traffic, safety equipment or medical equipment for life support. 4. design your application so that the product is used within the ranges guaranteed by hitachi particularly for maximum rating, operating supply voltage range, heat radiation characteristics, installation conditions and other characteristics. hitachi bears no responsibility for failure or damage when used beyond the guaranteed ranges. even within the guaranteed ranges, consider normally foreseeable failure rates or failure modes in semiconductor devices and employ systemic measures such as fail-safes, so that the equipment incorporating hitachi product does not cause bodily injury, fire or other consequential damage due to operation of the hitachi product. 5. this product is not designed to be radiation resistant. 6. no one is permitted to reproduce or duplicate, in any form, the whole or part of this document without written approval from hitachi. 7. contact hitachi? sales office for any questions regarding this document or hitachi semiconductor products.
preface the sh7708, sh7708s, and sh7708r(sh7708 series) use a risc (reduced instruction set computer) type cpu to achieve high-performance computational processing. also incorporating the peripheral functions required for system configuration plus power-down features essential for microcontroller application systems, the sh7708 series is a new-generation risc microcontroller (superh risc engine). the sh7708 series have a risc type instruction set, with basic instructions executed in one state, offering a drastic improvement in instruction execution speed. it also has an on-chip 32-bit multiplier (producing a 64-bit result) capable of high-speed multiply-and-accumulate operations. the sh7708 series? instructions are upward-compatible with those of the sh-1 and sh-2, facilitating migration from these series to the sh7708 series. sh7708r is completely pin compatible with the sh7708s. on-chip supporting modules that enable a user system to be configured with a minimum of components include oscillation circuits, an interrupt controller (intc), timers, a realtime clock (rtc), and a serial communication interface (sci). a user break controller (ubc) is provided as an on-chip module supporting program development, allowing easy configuration of a simple debugger. on-chip cache memory improves cpu processing performance, and a built-in memory management unit (mmu) performs address translation between a 4-gigabyte virtual space and physical space. an on-chip bus state controller (bsc) provides more efficient external memory access, and enables direct connection to synchronous dram, dram, and pseudo-sram without the need for glue logic. this hardware manual describes the hardware of the sh7708 series. details of instructions can be found in the programming manual. related manuals sh7708series instructions sh-3/sh-3e/sh3-dsp programming manual please consult your hitachi sales representative for details of development environment system.

1 contents section 1 overview and pin functions ...............................................1 1.1 sh7708 series features ........................................................................................1 1.2 block diagram ....................................................................................................6 1.3 pin description ...................................................................................................7 1.3.1 pin arrangement ......................................................................................7 1.3.2 sh7708 series pin functions .....................................................................8 section 2 cpu ..........................................................................13 2.1 register configuration ..........................................................................................13 2.1.1 privileged mode and banks .........................................................................13 2.1.2 general registers .....................................................................................16 2.1.3 system registers .....................................................................................17 2.1.4 control registers .....................................................................................17 2.2 data formats ......................................................................................................19 2.2.1 data format in registers ...........................................................................19 2.2.2 data format in memory ............................................................................19 2.3 instruction features ..............................................................................................20 2.3.1 execution environment .............................................................................20 2.3.2 addressing modes .....................................................................................22 2.3.3 instruction formats ..................................................................................26 2.4 instruction set .....................................................................................................29 2.4.1 instruction set classified by function ..........................................................29 2.4.2 instruction code map ................................................................................45 2.5 processor states and processor modes ......................................................................48 2.5.1 processor states .......................................................................................48 2.5.2 processor modes ......................................................................................49 section 3 memory management unit (mmu) .......................................51 3.1 overview ............................................................................................................51 3.1.1 features ..................................................................................................51 3.1.2 role of mmu .........................................................................................51 3.1.3 sh7708 series mmu ...............................................................................54 3.1.4 register configuration ..............................................................................57 3.2 register description .............................................................................................58 3.3 tlb functions ....................................................................................................60 3.3.1 configuration of the tlb ..........................................................................60 3.3.2 tlb indexing ..........................................................................................62 3.3.3 tlb address comparison ..........................................................................63 3.3.4 page management information ....................................................................65
2 3.4 mmu functions .................................................................................................66 3.4.1 mmu hardware management .....................................................................66 3.4.2 mmu software management .....................................................................66 3.4.3 mmu instruction (ldltb) .......................................................................67 3.4.4 avoiding synonym problems ....................................................................68 3.5 mmu exceptions ................................................................................................70 3.5.1 tlb miss exception ................................................................................70 3.5.2 tlb protection violation exception ............................................................71 3.5.3 tlb invalid exception ..............................................................................72 3.5.4 initial page write exception ......................................................................73 3.5.5 processing flow in event of mmu exception (same processing flow for address error) .........................................................................................................75 3.6 memory-mapped tlb ..........................................................................................77 3.6.1 address array ..........................................................................................77 3.6.2 data array ..............................................................................................78 3.6.3 usage examples ......................................................................................80 3.7 usage note .........................................................................................................80 section 4 exception handling .........................................................81 4.1 overview ...........................................................................................................81 4.1.1 features .................................................................................................81 4.1.2 register configuration ..............................................................................81 4.2 exception handling function .................................................................................81 4.2.1 exception handling flow ..........................................................................81 4.2.2 exception handling vector addresses ...........................................................82 4.2.3 acceptance of exceptions ..........................................................................84 4.2.4 exception codes ......................................................................................86 4.2.5 exception request masks ..........................................................................87 4.2.6 returning from exception handling ............................................................88 4.3 register description .............................................................................................88 4.4 exception handler operation ..................................................................................89 4.4.1 reset .....................................................................................................89 4.4.2 interrupts ................................................................................................89 4.4.3 general exceptions ...................................................................................89 4.5 individual exception operations .............................................................................90 4.5.1 resets ....................................................................................................90 4.5.2 general exceptions ...................................................................................91 4.5.3 interrupts ................................................................................................94 4.6 cautions ............................................................................................................95 section 5 cache .........................................................................97 5.1 overview ...........................................................................................................97 5.1.1 features .................................................................................................97
3 5.1.2 cache structure ........................................................................................97 5.1.3 register configuration ..............................................................................99 5.2 register description .............................................................................................99 5.2.1 cache control register (ccr) ...................................................................99 5.3 cache operation ................................................................................................. .100 5.3.1 searching the cache ................................................................................. .100 5.3.2 read access ........................................................................................... .102 5.3.3 write access .......................................................................................... .102 5.3.4 write-back buffer .................................................................................... .102 5.3.5 coherency of cache and external memory ................................................... .103 5.3.6 ram mode ............................................................................................ .103 5.4 memory-mapped cache ........................................................................................ .103 5.4.1 address array ......................................................................................... .103 5.4.2 data array ............................................................................................. .104 5.5 usage examples ................................................................................................. .106 5.5.1 invalidating specific entries ...................................................................... .106 5.5.2 reading the data of a specific entry ........................................................... .106 section 6 interrupt controller (intc) ................................................107 6.1 overview ........................................................................................................... .107 6.1.1 features ................................................................................................. .107 6.1.2 block diagram ........................................................................................ .108 6.1.3 pin configuration ................................................................................... .109 6.1.4 register configuration ............................................................................. .109 6.2 interrupt sources ................................................................................................. .109 6.2.1 nmi interrupts ........................................................................................ .110 6.2.2 irl interrupts ......................................................................................... .110 6.2.3 on-chip supporting module interrupts ....................................................... .112 6.2.4 interrupt exception handling and priority .................................................... .112 6.3 intc registers .................................................................................................. .115 6.3.1 interrupt priority registers a and b (ipra?prb) ........................................ .115 6.3.2 interrupt control register (icr) ................................................................ .116 6.4 intc operation .................................................................................................. .117 6.4.1 interrupt sequence ................................................................................... .117 6.4.2 multiple interrupts .................................................................................. .119 6.5 interrupt response time ...................................................................................... .120 section 7 user break controller (ubc) .............................................123 7.1 overview ........................................................................................................... .123 7.1.1 features ................................................................................................. .123 7.1.2 block diagram ........................................................................................ .123 7.1.3 register configuration ............................................................................. .125 7.1.4 break conditions and register settings ....................................................... .125
4 7.2 ubc register functions .......................................................................................126 7.2.1 break address register a (bara) ...............................................................126 7.2.2 break address register b (barb) ...............................................................126 7.2.3 break asid register a (basra) ...............................................................127 7.2.4 break asid register b (basrb) ................................................................127 7.2.5 break address mask register a (bamra) ...................................................127 7.2.6 break address mask register b (bamrb) ....................................................128 7.2.7 break bus cycle register a (bbra) ...........................................................128 7.2.8 break bus cycle register b (bbrb) ............................................................129 7.2.9 break data register b (bdrb) ...................................................................130 7.2.10 break data mask register b (bdmrb) ......................................................131 7.2.11 break control register (brcr) ................................................................132 7.3 ubc operation ...................................................................................................134 7.3.1 user break operation flow ........................................................................134 7.3.2 instruction fetch cycle break .....................................................................135 7.3.3 data access cycle break ...........................................................................136 7.3.4 saved program counter (pc) value .............................................................137 7.3.5 examples of use ......................................................................................138 7.3.6 cautions ................................................................................................140 section 8 power-down modes ........................................................141 8.1 overview ...........................................................................................................141 8.1.1 power-down modes .................................................................................141 8.1.2 register configuration ..............................................................................142 8.1.3 pin configuration ....................................................................................143 8.2 register description .............................................................................................143 8.2.1 standby control register (stbcr) .............................................................143 8.3 sleep mode ........................................................................................................145 8.3.1 transition to sleep mode ..........................................................................145 8.3.2 canceling sleep mode ..............................................................................145 8.4 standby mode .....................................................................................................145 8.4.1 transition to standby mode .......................................................................145 8.4.2 canceling standby mode ...........................................................................146 8.4.3 clock pause function ...............................................................................147 8.5 module standby function .....................................................................................147 8.5.1 transition to module standby function .......................................................147 8.5.2 clearing the module standby function ........................................................148 8.6 timing of status pin changes ...........................................................................148 8.6.1 timing for resets ....................................................................................148 8.6.2 timing for canceling standbys ..................................................................150 8.6.3 timing for canceling sleep mode ...............................................................151 8.7 hardware standby mode ........................................................................................153 8.7.1 transition to hardware standby mode ..........................................................153
5 8.7.2 canceling hardware standby mode ............................................................. .154 8.7.3 hardware standby mode timing ................................................................. .154 section 9 on-chip oscillation circuits ...............................................157 9.1 overview ........................................................................................................... .157 9.1.1 features ................................................................................................. .157 9.2 overview of the cpg .......................................................................................... .158 9.2.1 cpg block diagram ................................................................................ .158 9.2.2 cpg pin configuration ............................................................................ .161 9.2.3 cpg register configuration ..................................................................... .161 9.3 clock operating modes ........................................................................................ .162 9.4 register descriptions ........................................................................................... .170 9.4.1 frequency control register (frqcr) ......................................................... .170 9.5 changing the frequency ....................................................................................... .174 9.5.1 changing the multiplication rate .............................................................. .174 9.5.2 changing the division ratio ..................................................................... .174 9.6 pll standby function ......................................................................................... .175 9.6.1 overview of the pll standby function ....................................................... .175 9.6.2 usage .................................................................................................... .175 9.7 controlling clock output .................................................................................... .176 9.7.1 clock modes 0? .................................................................................... .176 9.7.2 clock modes 3 and 4 ............................................................................... .176 9.8 overview of the watchbog timer (wdt) ................................................................ .177 9.8.1 block diagram of the wdt ....................................................................... .177 9.8.2 register configurations ............................................................................ .177 9.9 wdt registers ................................................................................................... .178 9.9.1 watchdog timer counter (wtcnt) ........................................................... .178 9.9.2 watchdog timer control/status register (wtcsr) ...................................... .178 9.9.3 notes on register access .......................................................................... .180 9.10 using the wdt ................................................................................................ .181 9.10.1 canceling standbys ................................................................................ .181 9.10.2 changing the frequency .......................................................................... .181 9.10.3 using watchdog timer mode ................................................................... .182 9.10.4 using interval timer mode ...................................................................... .182 9.10.5 usage notes ......................................................................................... .183 9.11 notes on board design ....................................................................................... .184 section 10 bus state controller (bsc) ..............................................187 10.1 overview ......................................................................................................... .187 10.1.1 features ............................................................................................... .187 10.1.2 block diagram ...................................................................................... .188 10.1.3 pin configuration .................................................................................. .190 10.1.4 register configuration ........................................................................... .192
6 10.1.5 area overview .......................................................................................193 10.1.6 pcmcia support ..................................................................................196 10.2 bsc registers ...................................................................................................200 10.2.1 bus control register 1 (bcr1) ................................................................200 10.2.2 bus control register 2 (bcr2) ................................................................203 10.2.3 wait state control register 1 (wcr1) ......................................................204 10.2.4 wait state control register 2 (wcr2) ......................................................205 10.2.5 individual memory control register (mcr) ...............................................208 10.2.6 dram control register (dcr) ...............................................................213 10.2.7 pcmcia control register (pcr) .............................................................215 10.2.8 synchronous dram mode register (sdmr) .............................................216 10.2.9 refresh timer control/status register (rtcsr) .........................................217 10.2.10 refresh timer counter (rtcnt) ............................................................219 10.2.11 refresh time constant register (rtcor) ................................................220 10.2.12 refresh count register (rfcr) ..............................................................220 10.2.13 cautions on accessing refresh control related registers ............................221 10.3 bsc operation ..................................................................................................222 10.3.1 endian/access size and data alignment .....................................................222 10.3.2 description of areas ...............................................................................228 10.3.3 basic interface ........................................................................................231 10.3.4 dram interface .....................................................................................237 10.3.5 synchronous dram interface ..................................................................253 10.3.6 pseudo-sram direct connection .............................................................269 10.3.7 burst rom interface ...............................................................................278 10.3.8 pcmcia interface ..................................................................................281 10.3.9 waits between access cycles ...................................................................293 10.3.10 bus arbitration ....................................................................................294 section 11 timer (tmu) ...............................................................297 11.1 overview ..........................................................................................................297 11.1.1 features ................................................................................................297 11.1.2 block diagram .......................................................................................297 11.1.3 pin configuration ..................................................................................299 11.1.4 register configuration ............................................................................299 11.2 tmu registers ..................................................................................................300 11.2.1 timer output control register (tocr) .....................................................300 11.2.2 timer start register (tstr) ....................................................................301 11.2.3 timer control register (tcr) ..................................................................302 11.2.4 timer constant register (tcor) ..............................................................305 11.2.5 timer counters (tcnt) ..........................................................................306 11.2.6 input capture register (tcpr2) ...............................................................307 11.3 tmu operation .................................................................................................308 11.3.1 overview ..............................................................................................308
7 11.3.2 basic functions ..................................................................................... .308 11.4 interrupts ......................................................................................................... .312 11.4.1 status flag set timing .......................................................................... .312 11.4.2 status flag clear timing ........................................................................ .313 11.4.3 interrupt sources and priorities ................................................................. .313 11.5 usage notes ..................................................................................................... .314 11.5.1 writing to registers ............................................................................... .314 11.5.2 reading registers .................................................................................. .314 11.5.3 clearing unf in the tcr register ........................................................... .314 section 12 realtime clock (rtc) ....................................................315 12.1 overview ......................................................................................................... .315 12.1.1 features ............................................................................................... .315 12.1.2 block diagram ...................................................................................... .315 12.1.3 pin configuration .................................................................................. .317 12.1.4 rtc register configuration .................................................................... .318 12.2 rtc registers .................................................................................................. .318 12.2.1 64-hz counter (r64cnt) ....................................................................... .318 12.2.2 second counter (rseccnt) ................................................................... .319 12.2.3 minute counter (rmincnt) .................................................................. .319 12.2.4 hour counter (rhrcnt) ....................................................................... .320 12.2.5 day of the week counter (rwkcnt) ....................................................... .320 12.2.6 date counter (rdaycnt) ..................................................................... .321 12.2.7 month counter (rmoncnt) .................................................................. .322 12.2.8 year counter (ryrcnt) ........................................................................ .322 12.2.9 second alarm register (rsecar) ........................................................... .323 12.2.10 minute alarm register (rminar) ......................................................... .323 12.2.11 hour alarm register (rhrar) .............................................................. .324 12.2.12 day of the week alarm register (rwkar) ............................................. .324 12.2.13 date alarm register (rdayar) ............................................................ .325 12.2.14 month alarm register (rmonar) ........................................................ .326 12.2.15 rtc control register 1 (rcr1) ............................................................ .326 12.2.16 rtc control register 2 (rcr2) ............................................................ .328 12.3 rtc operation ................................................................................................. .329 12.3.1 initial settings of registers after power-on ................................................ .329 12.3.2 setting the time ................................................................................... .329 12.3.3 reading the time .................................................................................. .331 12.3.4 alarm function ..................................................................................... .332 12.3.5 crystal oscillator circuit ........................................................................ .333 12.4 usage notes ..................................................................................................... .334 12.4.1 flag clearing ........................................................................................ .334 section 13 serial communication interface (sci) ..................................335
8 13.1 overview ..........................................................................................................335 13.1.1 features ................................................................................................335 13.1.2 block diagram .......................................................................................336 13.1.3 pin configuration ..................................................................................337 13.1.4 register configuration ............................................................................337 13.2 register descriptions ..........................................................................................338 13.2.1 receive shift register (scrsr) ...............................................................338 13.2.2 receive data register (scrdr) ...............................................................338 13.2.3 transmit shift register (sctsr) .............................................................338 13.2.4 transmit data register (sctdr) ..............................................................339 13.2.5 serial mode register (scsmr) ................................................................339 13.2.6 serial control register (scscr) ..............................................................342 13.2.7 serial status register (scssr) ................................................................345 13.2.8 serial port register (scsptr) .................................................................349 13.2.9 bit rate register (scbrr) ......................................................................350 13.3 operation .........................................................................................................358 13.3.1 overview ..............................................................................................358 13.3.2 operation in asynchronous mode ..............................................................360 13.3.3 multiprocessor communication ................................................................370 13.3.4 synchronous operation ...........................................................................378 13.4 sci interrupt sources .........................................................................................388 13.5 usage notes ......................................................................................................388 section 14 smart card interface .......................................................393 14.1 overview ..........................................................................................................393 14.1.1 features ................................................................................................393 14.1.2 block diagram .......................................................................................394 14.1.3 pin configuration ..................................................................................395 14.1.4 register configuration ............................................................................395 14.2 register descriptions ..........................................................................................395 14.2.1 smart card mode register (scscmr) ......................................................396 14.2.2 serial status register (scssr) ................................................................397 14.3 operation .........................................................................................................398 14.3.1 overview ..............................................................................................398 14.3.2 pin connections ....................................................................................399 14.3.3 data format ..........................................................................................400 14.3.4 register settings ....................................................................................401 14.3.5 clock ...................................................................................................403 14.3.6 data transmission and reception ..............................................................405 14.4 usage notes ......................................................................................................412 14.4.1 receive data timing and receive margin in asynchronous mode ...................412 14.4.2 retransmission (receive and transmit modes) .............................................414
9 section 15 i/o ports ....................................................................417 15.1 overview ......................................................................................................... .417 15.1.1 features ............................................................................................... .417 15.1.2 block diagram ...................................................................................... .417 15.1.3 pin configuration .................................................................................. .420 15.1.4 register configuration ........................................................................... .421 15.2 register descriptions ......................................................................................... .421 15.2.1 port control register (pctr) ................................................................. .421 15.2.2 port data register (pdtr) ...................................................................... .422 15.2.3 serial port register (scsptr) ................................................................ .423 section 16 electrical characteristics(-sh7708, sh7708s-) .......................425 16.1 absolute maximum ratings ............................................................................... .425 16.2 dc characteristics ............................................................................................. .426 16.3 ac characteristics ............................................................................................. .427 16.3.1 clock timing ....................................................................................... .428 16.3.2 control signal timing ........................................................................... .438 16.3.3 ac bus timing specifications ................................................................. .442 16.3.4 basic timing ........................................................................................ .446 16.3.5 burst rom timing ............................................................................... .449 16.3.6 dram timing ..................................................................................... .452 16.3.7 synchronous dram timing ................................................................... .462 16.3.8 pseudo-sram timing ........................................................................... .473 16.3.9 pcmcia timing .................................................................................. .478 16.3.10 peripheral module signal timing ........................................................... .485 16.3.11 ac characteristics test conditions ......................................................... .488 section 17 electrical characteristics (-sh7708r-) .................................489 17.1 absolute maximum ratings ............................................................................... .489 17.2 dc characteristics ............................................................................................. .490 17.3 ac characteristics ............................................................................................. .491 17.3.1 clock timing ....................................................................................... .492 17.3.2 control signal timing ........................................................................... .498 17.3.3 ac bus timing specifications ................................................................. .502 17.3.4 basic timing ........................................................................................ .506 17.3.5 burst rom timing ............................................................................... .510 17.3.6 dram timing ..................................................................................... .513 17.3.7 synchronous dram timing ................................................................... .523 17.3.8 pseudo-sram timing ........................................................................... .534 17.3.9 pcmcia timing .................................................................................. .539 17.3.10 peripheral module signal timing ........................................................... .546 17.3.11 ac characteristics test conditions ......................................................... .549
10 appendix a pin functions .............................................................551 a.1 pin states ..........................................................................................................551 a.2 pin specifications ...............................................................................................554 a.3 handling of unused pins ......................................................................................557 a.4 pin states in access to each address space .............................................................558 appendix b control registers .........................................................594 b.1 register address map ...........................................................................................594 b.2 register bit list .................................................................................................598 b.3 register states in reset and power-down states .......................................................604 appendix c delay time variation due to load capacitance ......................608 appendix d package dimensions .....................................................609
1 section 1 overview and pin functions 1 . 1 sh7708 series features the sh7708, sh7708s, and sh7708r(sh7708 series) are 32-bit risc (reduced instruction set computer) microcomputers, featuring object code upward-compatibility with sh-1 and sh-2 microcomputers. the sh7708r is completely pin compatible with the sh7708s. it includes an 8- kbyte cache with a choice of write-back or write-through mode, and an mmu (memory management unit) with a 128-entry 4-way set associative tlb (translation lookaside buffer). the sh7708 series have an on-chip bus state controller (bsc) that allows direct connection to dram, synchronous dram (sdram), and pseudo-sram (psram) without external circuitry. its 16-bit fixed-length instruction set enables program code size to be reduced by almost 50% compared with 32-bit instructions. the features of the sh7708 series are summarized in table 1.1.
2 table 1.1 sh7708 series features item features cpu original hitachi superh risc engine architecture 32-bit internal data bus general-register machine ? sixteen 32-bit general registers (eight 32-bit bank registers) ? five 32-bit control registers ? four 32-bit system registers risc-type instruction set (upward compatibility with the sh-1 and sh-2 series) ? instruction length: 16-bit fixed length for improved code efficiency ? load-store architecture ? delayed branch instructions ? c-oriented instruction set instruction execution time: one instruction/cycle for basic instructions logical address space: 4 gbytes (448-mbyte actual memory space) space identifier asid: 8 bits, 256 logical address spaces on-chip multiplier five-stage pipeline operating modes, clock pulse generator clock mode: selected from an on-chip oscillator module, a frequency- doubling circuit, or a clock output by combining them by pll synchronization processing states: ? power-on reset state ? manual reset state ? exception processing state ? program execution state ? power-down state ? bus-released state power-down modes: ? sleep mode ? standby mode ? hardware standby mode(sh7708s, sh7708r only) on-chip clock pulse generator one watchdog timer channel
3 table 1.1 sh7708 series features (cont) item features memory management unit (mmu) 4 gbytes of address space, 256 address spaces (8-bit asid) supports single virtual memory mode and multiple virtual memory mode paging system supports multiple page sizes: 1 or 4 kbytes 128-entry, 4-way set associative tlb supports software selection of replacement method and random-replacement algorithms contents of tlb are directly accessible by address mapping cache memory choice of operating mode ? normal mode (8-kbyte cache) ? ram mode (4-kbyte cache + 4-kbyte ram) mixed instruction/data, 128 entries, 16-byte block length ? 4-way set associative (8-kbyte cache) ? 2-way set associative (4-kbyte cache) selectable write method (write-back/write-through), lru (least recently used) replacement algorithm single-stage write-back buffer contents of tlb can be accessed directly by address mapping (can be used as on-chip memory) interrupt controller (intc) 5 external interrupt pins (nmi, irl0 to irl3) encoded input of 15 external interrupt sources via pins irl0 to irl3 on-chip peripheral interrupts: priority levels set for each module user break controller (ubc) supports debugging by user break interrupts 2 break channels addresses, data values, type of access, and data size can all be set as break conditions supports a sequential break function
4 table 1.1 sh7708 series features (cont) item features bus state controller (bsc) supports external memory access ? 32/16/8-bit external data bus physical address space divided into seven areas, each a maximum 64 mbytes, with the following features settable for each area: ? bus size (8, 16, or 32 bits) ? number of wait cycles (also supports a hardware wait function) ? setting the type of space enables direct connection to dram, synchronous dram, pseudo-sram, and burst rom ? supports fast page mode and edo for dram ? supports pcmcia interface ? outputs chip select signal (cs0?s6) for corresponding area dram/synchronous dram/pseudo-sram refresh function ? programmable refresh interval ? supports cas-before-ras refresh and self-refresh modes dram/synchronous dram/pseudo-sram burst access function usable as either big- or little-endian machine timer 3-channel auto-reload type 32-bit timer input capture function 6 types of counter input clock can be selected maximum resolution: 2 mhz realtime clock (rtc) on-chip clock and calendar functions on-chip 32-khz crystal oscillator circuit with a maximum resolution (interrupt cycle) of 1/256 second serial communi- cation interface (sci) selection of asynchronous or synchronous mode full-duplex communication supports smart card interface package 144-pin plastic qfp(fp-144) 144-pin plastic tqfp (tfp-144) * note: sh7708s only
5 table 1.1 sh7708 series features (cont) item features product line-up product number on-chip voltage operation frequency model package sh7708 3.3v 0.3 v 60mhz HD6417708f60 144-pin plastic lqfp (fp-144f) sh7708s 3.3v 0.3 v 60mhz HD6417708sf60 HD6417708stf60 144-pin plastic tqfp (tfp-144) sh7708r 3.15-3.6v (typ.) 100mhz HD6417708rf100 144-pin plastic l-qfp (fp-144f)
6 1 . 2 block diagram figure 1.1 shows a block diagram of the sh7708 series. multiplier mmu (memory management unit) mixed instruction/ data tlb cache controller mixed instruction/ data cache memory cpu interrupt controller 32-bit data bus 32-bit data bus user break controller (2 channels) bus state controller pll built-in clock oscillator wdt (watchdog timer) external bus interface i/o ports sci (serial communication interface) timer (3 channels) realtime clock peripheral address bus 16-bit peripheral data bus 32-bit virtual address bus 32-bit physical address bus figure 1.1 sh7708 series block diagram
7 1 . 3 pin description 1.3.1 pin arrangement cs6 / ce1b rd rd wr 100 80 90 md3/ ce2a md4/ ce2b vcc ckio vss nc * 1 status0 status1 back irqout iois16 irl0 irl1 irl2 irl3 nmi bs reset breq md0/sck md1/txd md2/rxd vcc vss * 4 xtal extal vcc (pll2) * 2 cap2 vss (pll2) * 2 vcc (pll1) * 2 cap1 vss (pll1) * 2 30 70 60 50 40 1 10 20 d27 d26 d25 d24 d23/port7 vss vcc d22/port6 d21/port5 d20/port4 sh7708(fp-144f) sh7708s(tfp-144, fp-144f) sh7708r(fp-144f) top view d19/port3 d18/port2 vss vcc d13 d12 d11 d10 d17/port1 d16/port0 d15 d14 vss vcc d9 d8 d7 d6 d5 vss vcc d4 d3 d2 d1 d0 120 130 140 144 cs5 / ce1a cs4 cs3 cs2 cs1 cs0 vss vcc we3 / dqmuu / iciowr we2 / dqmul / iciord cashh / cas2h cashl / cas2l vss vcc we1 / dqmlu we0 / dqmll caslh casll / cas / oe vss vcc ras / ce md5/ ras2 cke wait vss tclk vcc (rtc) * 2 xtal2 extal2 vss (rtc) * 2 vcc d31 d30 d29 d28 vss a25 a24 a23 vcc vss a22 a21 a20 a19 a18 a17 a16 vcc vss a15 a14 a13 vcc vss a12 a11 a10 vcc vss a9 a8 a7 a6 a5 a4 vcc vss a3 a2 a1 a0 notes: 1. make no connection. 2. power supply pins for the on-chip rtc and on-chip pll. these pins must be connected to the power supply even if the rtc or pll are not used. 3. power supply pins for the on-chip pll. except in hardware standby mode, these pins must be connected to the power supply even if the pll is not used. 4. sh7708:vcc sh7708s,sh7708r:ca figure 1.2 pin arrangement
8 1.3.2 sh7708 series pin functions table 1.2 sh7708 series pin functions no. terminal i / o description 1 d27 i/o data bus 2 d26 i/o data bus 3 d25 i/o data bus 4 d24 i/o data bus 5 d23/port7 i/o data bus/port 6v ss power power (0 v) 7v cc power power (3.3 v) 8 d22/port6 i/o data bus/port 9 d21/port5 i/o data bus/port 10 d20/port4 i/o data bus/port 11 d19/port3 i/o data bus/port 12 d18/port2 i/o data bus/port 13 d17/port1 i/o data bus/port 14 d16/port0 i/o data bus/port 15 d15 i/o data bus 16 d14 i/o data bus 17 v ss power power (0 v) 18 v cc power power (3.3 v) 19 v ss power power (0 v) 20 v cc power power (3.3 v) 21 d13 i/o data bus 22 d12 i/o data bus 23 d11 i/o data bus 24 d10 i/o data bus 25 d9 i/o data bus 26 d8 i/o data bus 27 d7 i/o data bus 28 d6 i/o data bus 29 d5 i/o data bus
9 table 1.2 sh7708 series pin functions (cont) no. terminal i / o description 30 v ss power power (0 v) 31 v cc power power (3.3 v) 32 d4 i/o data bus 33 d3 i/o data bus 34 d2 i/o data bus 35 d1 i/o data bus 36 d0 i/o data bus 37 a0 o address bus 38 a1 o address bus 39 a2 o address bus 40 a3 o address bus 41 v ss power power (0 v) 42 v cc power power (3.3 v) 43 a4 o address bus 44 a5 o address bus 45 a6 o address bus 46 a7 o address bus 47 a8 o address bus 48 a9 o address bus 49 v ss power power (0 v) 50 v cc power power (3.3 v) 51 a10 o address bus 52 a11 o address bus 53 a12 o address bus 54 v ss power power (0 v) 55 v cc power power (3.3 v) 56 a13 o address bus 57 a14 o address bus 58 a15 o address bus 59 v ss power power (0 v) 60 v cc power power (3.3 v)
10 table 1.2 sh7708 series pin functions (cont) no. terminal i / o description 61 a16 o address bus 62 a17 o address bus 63 a18 o address bus 64 a19 o address bus 65 a20 o address bus 66 a21 o address bus 67 a22 o address bus 68 v ss power power (0 v) 69 v cc power power (3.3 v) 70 a23 o address bus 71 a24 o address bus 72 a25 o address bus 73 v ss (pll1)* 2 power power (0 v) for pll1 74 cap1 o external capacitance pin for pll1 75 v cc (pll1)* 2 power power (3.3 v) for pll1 76 v ss (pll2)* 2 power power (0 v) for pll2 77 cap2 o external capacitance pin for pll2 78 v cc (pll2)* 2 power power (3.3 v) for pll2 79 extal i external clock/crystal oscillator pin 80 xtal o crystal oscillator pin 81(sh7708) v cc power power(3.3v) 81(sh7708s, sh7708r) ca i chip active 82 v ss power power (0 v) 83 v cc power power (3.3 v) 84 md2/rxd i operating mode pin/serial data input 85 md1/txd i/o operating mode pin/serial data output 86 md0/sck i/o operating mode pin/serial clock 87 breq i bus request 88 reset i reset 89 nmi i nonmaskable interrupt request 90 irl3 i external interrupt source input
11 table 1.2 sh7708 series pin functions (cont) no. terminal i / o description 91 irl2 i external interrupt source input 92 irl1 i external interrupt source input 93 irl0 i external interrupt source input 94 iois16 i io16-bit instruction 95 irqout o bus request notification output 96 back o bus acknowledge 97 status1 o processor status 98 status0 o processor status 99 nc o leave unconnected 100 v ss power power (0 v) 101 ckio i/o system clock i/o 102 v cc power power (3.3 v) 103 md4/ ce2b i/o operating mode pin/pcmcia ce pin 104 md3/ ce2a i/o operating mode pin/pcmcia ce pin 105 bs o bus cycle start 106 rd/ wr o read/write 107 rd o read pulse 108 cs6 / ce1b o chip select 6/pcmcia ce pin 109 cs5 / ce1a o chip select 5/pcmcia ce pin 110 cs4 o chip select 4 111 cs3 o chip select 3 112 cs2 o chip select 2 113 cs1 o chip select 1 114 cs0 o chip select 0 115 v ss power power (0 v) 116 v cc power power (3.3 v) 117 we3 /dqmuu/ iciowr o d31?24 selection signal/io write 118 we2 /dqmul/ iciord o d23?16 selection signal/io read 119 cashh / cas2h o d31?24/d15?8 selection signal 120 cashl / cas2l o d23?16/d7?0 selection signal 121 v ss power power (0 v)
12 table 1.2 sh7708 series pin functions (cont) no. terminal i / o description 122 v cc power power (3.3 v) 123 we1 /dqmlu o d15?8 selection signal 124 we0 /dqmll o d7?0 selection signal 125 caslh o d15?8 selection signal 126 casll / cas / oe o d7?0 selection/memory selection signal 127 v ss power power (0 v) 128 v cc power power (3.3 v) 129 ras / ce o ras for dram, sdram/ce for psram 130 md5/ ras2 i/o operating mode pin/ras for dram 131 cke o clock enable control for sdram 132 wait i hardware wait request 133 v ss power power (0 v) 134 tclk i/o clock i/o for tmu/rtc 135 v cc (rtc)* 3 power power (3.3 v) 136 xtal2 o crystal oscillator pin for on-chip rtc 137 extal2 i crystal oscillator pin for on-chip rtc 138 v ss (rtc)* 3 power power (0 v) 139 v cc power power (3.3 v) 140 d31 i/o data bus 141 d30 i/o data bus 142 d29 i/o data bus 143 d28 i/o data bus 144 v ss power power (0 v) notes: 1. except in hardware standby mode, connect all v cc and v ss pins to the system power supply (power should be supplied constantly). in hardware standby mode, power should be supplied at least to v cc (rtc) and v ss (rtc). if power is not supplied to v cc and v ss pins other than v cc (rtc) and v ss (rtc), hold the ca pin low. 2. power should be supplied regardless of whether or not the on-chip pll is used. 3. power should be supplied regardless of whether or not the rtc is used.
13 section 2 cpu 2 . 1 register configuration 2.1.1 privileged mode and banks processor modes: there are two processor modes: user mode and privileged mode. the sh7708 series normally operates in user mode, and enters privileged mode when an exception occurs or an interrupt is accepted. there are three kinds of registers?eneral registers, system registers, and control registers?nd the registers that can be accessed differ in the two processor modes. general registers: there are 16 general registers, designated r0 to r15. general registers r0 to r7 are banked registers which are switched by a processor mode change. in privileged mode, the register bank bit (rb) in the status register (sr) defines which banked register set is accessed as general registers, and which set is accessed only through the load control register (ldc) and store control register (stc) instructions. when the rb bit is 1, bank1 general registers r0_bank1?7_bank1 and non-banked general registers r8?15 function as the general register set, with bank0 general registers r0_bank0 r7_bank0 accessed only by the ldc/stc instructions. when the rb bit is 0, bank0 general registers r0_bank0?7_bank0 and nonbanked general registers r8?15 function as the general register set, with bank1 general registers r0_bank1 r7_bank1 accessed only by the ldc/stc instructions. in user mode, the 16 registers comprising bank 0 general registers r0_bank0?7_bank0 and non-banked registers r8?15 can be accessed as general registers r0?15, and bank 1 general registers r0_bank1 r7_bank1 cannot be accessed. control registers: control registers comprise the global base register (gbr) and status register (sr) which can be accessed in both processor modes, and the saved status register (ssr), saved program counter (spc), and vector base register (vbr) which can only be accessed in privileged mode. some bits of the status register (such as the rb bit) can only be accessed in privileged mode. system registers: system registers comprise the multiply and accumulate registers (macl/mach), the procedure register (pr), and the program counter (pc). access to these registers does not depend on the processor mode. the register configuration in each mode is shown in figures 2.1 and 2.2. switching between user mode and privileged mode is controlled by the processor mode bit (md) in the status register.
14 31 0 r0 _ bank0* 1, * 2 r1 _ bank0* 2 r2 _ bank0* 2 r3 _ bank0* 2 r4 _ bank0* 2 r5 _ bank0* 2 r6 _ bank0* 2 r7 _ bank0* 2 r8 r9 r10 r11 r12 r13 r14 r15 sr gbr mach macl pr pc user mode register configuration notes: 1. 2. r0 functions as an index register in the indexed register-indirect addressing mode and indexed gbr-indirect addressing mode. banked register figure 2.1 user mode register configuration
15 r0_bank1* 1 , * 2 r1_bank1* 2 r2_bank1* 2 r3_bank1* 2 r4_bank1* 2 r5_bank1* 2 r6_bank1* 2 r7_bank1* 2 r8 r9 r10 r11 r12 r13 r14 r15 sr ssr pc spc gbr mach macl pr vbr 31 0 a. privileged mode register configuration (rb = 1) r0_bank0* 1 , * 3 r1_bank0* 3 r2_bank0* 3 r3_bank0* 3 r4_bank0* 3 r5_bank0* 3 r6_bank0* 3 r7_bank0* 3 r0_bank0* 1 , * 3 r1_bank0* 3 r2_bank0* 3 r3_bank0* 3 r4_bank0* 3 r5_bank0* 3 r6_bank0* 3 r7_bank0* 3 r8 r9 r10 r11 r12 r13 r14 r15 sr ssr pc spc gbr mach macl pr vbr 31 0 b. privileged mode register configuration (rb = 0) r0_bank1* 1 , * 2 r1_bank1* 2 r2_bank1* 2 r3_bank1* 2 r4_bank1* 2 r5_bank1* 2 r6_bank1* 2 r7_bank1* 2 notes: 1. 2. 3. r0 functions as an index register in the indexed register-indirect addressing mode and indexed gbr- indirect addressing mode. banked register when the rb bit of the sr register is 1, the register can be accessed for general use. when the rb bit is 0, it can only be accessed with the ldc/stc instruction. banked register when the rb bit of the sr register is 0, the register can be accessed for general use. when the rb bit is 1, it can only be accessed with the ldc/stc instruction. figure 2.2 privileged mode register configuration
16 register values after a reset are shown in table 2.1. table 2.1 initial register values type registers initial value general registers r0 to r15 undefined control registers sr md bit = 1, rb bit = 1, bl bit = 1, i3 i0 = 1111 (h'f), reserved bits = 0, others undefined gbr, ssr, spc undefined vbr h'00000000 system registers mach, macl, pr undefined pc h'a0000000 note: initialized by a power-on reset or manual reset. 2.1.2 general registers there are 16 general registers, designated r0 to r15 (figure 2.3). general registers r0 to r7 are banked registers, with a different r0?7 register bank (r0_bank0?7_bank0 or r0_bank1 r7_bank1) being accessed according to the processor mode. for details, see section 2.1.1, privileged mode and banks. 31 0 r0* 1, * 2 general registers notes: r0 functions as an index register in the indexed register-indirect addressing mode and indexed gbr-indirect addressing mode. in some instructions, only r0 can be used as the source register or destination register. r0?7 are banked registers. in privileged mode, sr.rb specifies which banked registers are accessed as general registers (r0_bank0?7_bank0 or r0_bank1?7_bank1). 1. 2. r1* 2 r2* 2 r3* 2 r4* 2 r5* 2 r6* 2 r7* 2 r8 r9 r10 r11 r12 r13 r14 r15 figure 2.3 general registers
17 2.1.3 system registers system registers can be accessed by the lds and sts instructions. when an exception occurs, the contents of the program counter (pc) are saved in the saved program counter (spc). the spc contents are restored to the pc by the rte instruction used at the end of the exception handling. there are four system registers, as follows. multiply and accumulate high register (mach) multiply and accumulate low register (macl) procedure register (pr) program counter (pc) the system register configuration is shown in figure 2.4. 31 0 31 0 31 0 system registers multiply and accumulate high and low registers (mach/l) store the results of multiply-and-accumulate operations. its contents are undefined after a reset. procedure register (pr) stores the return address for exiting a subroutine procedure. its contents are undefined after a reset. program counter (pc) indicates the address four addresses (two instructions) ahead of the currently executing instruction. initialized to h'a0000000 by a reset. pr pc mach macl figure 2.4 system registers 2.1.4 control registers control registers can be accessed in privileged mode using the ldc and stc instructions. the gbr register can also be accessed in user mode. there are five control registers, as follows: status register (sr) saved status register (ssr) saved program counter (spc) global base register (gbr) vector base register (vbr)
18 ssr saved status register (ssr) stores current sr value at time of exception to indicate processor status in return to instruction stream from exception handler. its contents are undefined after a reset. saved program counter (spc) stores current pc value at time of exception to indicate return address at completion of exception handling. its contents are undefined after a reset. global base register (gbr) stores base address of gbr-indirect addressing mode. the gbr-indirect addressing mode is used for on-chip supporting module register area data transfers and logic operations. the gbr register can also be accessed in user mode. its contents are undefined after a reset. vector base register (vbr) stores base address of exception handling vector area. initialized to h'0000000 by a reset. 31 0 spc 31 0 gbr 31 0 vbr 31 0 md bl m q 00 i3 i2 i1 i0 0 0 s t status register (sr) 31 29 28 27 10 9 8 7 0 1 3 0rb 30 md: rb: bl: m and q bits: i3?0 bits: s bit: t bit: 0 bits: processor operation mode bit: indicates the processor operation mode as follows: md =1: privileged mode; md = 0: user mode md is set to 1 on generation of an exception or interrupt , and is initialized to 1 by a reset. register bank bit: determines the bank of general registers r0?7 used in processing mode. rb = 1: r0_bank1?7_bank1 and r8?15 are general registers, and r0_bank0? r7_bank0 can be accessed by ldc/stc instructions. rb = 0: r0_bank0?7_bank0 and r8?15 are general registers, and r0_bank1? r7_bank1 can be accessed by ldc/stc instructions. rb is set to 1 on generation of an exception or interrupt , and is initialized to 1 by a reset. block bit bl = 1: exceptions and interrupts are suppressed. see section 4, exception handling, for details. bl = 0: exceptions and interrupts are accepted. bl is set to 1 on generation of an exception or interrupt , and is initialized to 1 by a reset. used by the div0s/u and div1 instructions. interrupt mask bits: 4-bit field indicating the interrupt request mask level. i3?0 do not change to the interrupt acceptance level when an interrupt is generated. initialized to b'1111 by a reset. used by the mac instruction. used by the movt, cmp/cond, tas, tst, bt, bf, sett, clrt, and dt instructions to indicate true (1) or false (0). used by the addv/c, subv/c, div0u/s, div1, negc, shar/l, shlr/l, rotr/l, and rotcr/l instructions to indicate a carry, borrow, overflow, or underflow. these bits always read 0, and the write value should always be 0. note: the m, q, s, and t bits can be set or cleared by special instructions in user mode. their values are undefined after a reset. all other bits can be read or written in privileged mode. figure 2.5 register set overview, control registers
19 2 . 2 data formats 2.2.1 data format in registers register operands are always longwords (32 bits, figure 2.6). when a memory operand is only a byte (8 bits) or a word (16 bits), it is sign-extended into a longword when loaded into a register. longword 31 0 figure 2.6 longword 2.2.2 data format in memory memory data formats are classified into bytes, words, and longwords. memory can be accessed in 8-bit byte, 16-bit word, or 32-bit longword form. a memory operand less than 32 bits in length is sign-extended before being stored in a register. a word operand must be accessed starting from a word boundary (even address of a 2-byte unit: address 2n), and a longword operand starting from a longword boundary (even address of a 4-byte unit: address 4n). an address error will result if this rule is not observed. a byte operand can be accessed from any address. big-endian or little-endian byte order can be selected for the data format. the endian mode should be set with the md5 external pin in a power-on reset. big-endian mode is selected when the md5 pin is low, and little-endian when high. the endian mode cannot be changed dynamically. bit positions are numbered left to right from most-significant to least-significant. thus, in a 32-bit longword, the leftmost bit, bit 31, is the most significant bit and the rightmost bit, bit 0, is the least significant bit. the data format in memory is shown in figure 2.7. in little-endian mode, data written in byte-size (8-bit) units should be read in byte-size units, and data written in word-size (16-bit) units should be read in word-size units.
20 longword longword 31 0 15 23 7 byte0 byte1 byte2 byte3 word1 big-endian mode word0 address a + 4 address a + 8 address a + 4 address a address a address a + 1 address a + 3 31 0 15 23 7 byte3 byte2 byte1 byte0 word0 little-endian mode word1 address a + 11 address a + 10 address a + 8 address a address a + 8 address a + 9 address a + 2 figure 2.7 byte, word, and longword alignment 2 . 3 instruction features 2.3.1 execution environment data length: the sh7708 series instruction set is implemented with fixed-length 16-bit wide instructions executed in a pipelined sequence with single-cycle execution for most instructions. all operations are executed in 32-bit longword units. memory can be accessed in 8-bit byte, 16-bit word, or 32-bit longword units, with byte or word units sign-extended into 32-bit longwords. literals are sign-extended in arithmetic operations (mov, add, and cmp/eq instructions) and zero-extended in logical operations (tst, and, or, and xor instructions). load/store architecture: the sh7708 series features a load-store architecture in which basic operations are executed in registers. operations requiring memory access are executed in registers following register loading, except for bit-manipulation operations such as logical and functions, which are executed directly in memory. delayed branching: unconditional branching is implemented as delayed branch operations. pipeline disruptions due to branching are minimized by the execution of the instruction following the delayed branch instruction prior to branching. conditional branch instructions are of two kinds, delayed and normal. bra trget add r1, r0 ;add is executed prior to branching to trget
21 t bit: the t bit in the status register (sr) is used to indicate the result of compare operations, and is read as a true/false condition determining if a conditional branch is taken or not. to improve processing speed, the t bit logic state is modified only by specific operations. an example of how the t bit may be used in a sequence of operations is shown below. add #1, r0 ;t bit not modified by add operation cmp/eq r1, r0 ;t bit set to 1 when r0 = 0 bt trget ;branch taken to trget when t bit = 1 (r0 = 0) literals: byte-length literals are inserted directly into the instruction code as immediate data. to maintain the 16-bit fixed-length instruction code, word or longword literals are stored in a table in main memory rather than inserted directly into the instruction code. the memory table is accessed by the mov instruction using pc-relative addressing with displacement, as follows: mov.w @(disp, pc), r0 absolute addresses: as with word and longword literals, absolute addresses must also be stored in a table in main memory. the value of the absolute address is transferred to a register and the operand access is specified by indexed register-indirect addressing, with the absolute address loaded (like word and longword immediate data) during instruction execution. 16-bit and 32-bit displacements: in the same way, 16-bit and 32-bit displacements also must be stored in a table in main memory. exactly like absolute addresses, the displacement value is transferred to a register and the operand access is specified by indexed register-indirect addressing, loading the displacement (like word and longword immediate data) during instruction execution.
22 2.3.2 addressing modes addressing modes and effective address calculation methods are shown in table 2.2. table 2.2 addressing modes and effective addresses addressing mode instructio n format effective address calculation methodcalculation formula register direct rn effective address is register rn. (operand is register rn contents.) register indirect @rn effective address is register rn contents. rn rn rn register indirect with post-increment @rn+ effective address is register rn contents. a constant is added to rn after instruction execution: 1 for a byte operand, 2 for a word operand, 4 for a longword operand. rn rn 1/2/4 + rn + 1/2/4 rn after instruction execution byte: rn + 1 ? rn word: rn + 2 ? rn longword: rn + 4 ? rn register indirect with pre-decrement @?n effective address is register rn contents, decremented by a constant beforehand: 1 for a byte operand, 2 for a word operand, 4 for a longword operand. rn 1/2/4 rn ?1/2/4 rn ?1/2/4 byte: rn ?1 ? rn word: rn ?2 ? rn longword: rn ?4 ? rn (instruction executed with rn after calculation)
23 table 2.2 addressing modes and effective addresses (cont) addressing mode instructio n format effective address calculation methodcalculation formula register indirect with displacement @(disp:4, rn) effective address is register rn contents with 4-bit displacement disp added. after disp is zero-extended, it is multiplied by 1 (byte), 2 (word), or 4 (longword), according to the operand size. rn 1/2/4 + disp (zero-extended) rn + disp 1/2/4 byte: rn + disp word: rn + disp 2 longword: rn + disp 4 indexed register indirect @(r0, rn) effective address is sum of register rn and r0 contents. rn r0 rn + r0 + rn + r0 gbr indirect with displacement @(disp:8, gbr) effective address is register gbr contents with 8-bit displacement disp added. after disp is zero-extended, it is multiplied by 1 (byte), 2 (word), or 4 (longword), according to the operand size. gbr 1/2/4 + disp (zero-extended) gbr + disp 1/2/4 byte: gbr + disp word: gbr + disp 2 longword: gbr + disp 4 indexed gbr indirect @(r0, gbr)effective address is sum of register gbr and r0 contents. gbr r0 gbr + r0 + gbr + r0
24 table 2.2 addressing modes and effective addresses (cont) addressing mode instructio n format effective address calculation methodcalculation formula pc-relative with displacement @(disp:8, pc) effective address is register pc contents with 8-bit displacement disp added. after disp is zero-extended, it is multiplied by 2 (word), or 4 (longword), according to the operand size. with a longword operand, the lower 2 bits of pc are masked. pc h'fffffffc + 2/4 x & (for longword) disp (zero-extended) pc + disp 2 or pc&h'fffffffc + disp 4 word: pc + disp 2 longword: pc & h'ffff fffc + disp 4 pc-relative disp:8 effective address is register pc contents with 8-bit displacement disp added after being sign-extended and multiplied by 2. pc 2 + disp (sign-extended) pc + disp 2 pc + disp 2 disp:12 effective address is register pc contents with 12-bit displacement disp added after being sign-extended and multiplied by 2. pc 2 + disp (sign-extended) pc + disp 2 pc + disp 2
25 table 2.2 addressing modes and effective addresses (cont) addressing mode instructio n format effective address calculation methodcalculation formula pc-relative rn effective address is sum of register pc and rn contents. pc rn + pc + rn pc + rn immediate #imm:8 8-bit immediate data imm of tst, and, or, or xor instruction is zero-extended. #imm:8 8-bit immediate data imm of mov, add, or cmp/eq instruction is sign-extended. #imm:8 8-bit immediate data imm of trapa instruction is zero-extended and multiplied by 4. note: for the addressing modes below that use a displacement (disp), the assembler descriptions in this manual show the value before scaling (x1, x2, or x4) is performed according to the operand size. this is done to clarify the operation of the ic. refer to the relevant assembler notation rules for the actual assembler descriptions. @ (disp:4, rn) ; register indirect with displacement @ (disp:8, rn) ; gbr indirect with displacement @ (disp:8, pc) ; pc-relative with displacement disp:8, disp:12; pc-relative
26 2.3.3 instruction formats table 2.3 explains the meaning of instruction formats and source and destination operands. the meaning of the operands depends on the operation code. the following symbols are used. xxxx: operation code mmmm: source register nnnn: destination register iiii: immediate data dddd: displacement table 2.3 instruction formats instruction format source operand destination operand instruction example 0 format xxxx xxxx xxxx xxxx 15 0 nop n format xxxx xxxx xxxx nnnn 15 0 nnnn: register direct movt rn control register or system register nnnn: register direct sts mach,rn control register or system register nnnn: register indirect with pre-decrement stc.l sr,@?n m format xxxx mmmm xxxx xxxx 15 0 mmmm: register direct control register or system register ldc rm,sr mmmm: register indirect with post- increment control register or system register ldc.l @rm+,sr mmmm: register indirect jmp @rm mmmm: pc- relative using rm braf rm
27 table 2.3 instruction formats (cont) instruction format source operand destination operand instruction example nm format nnnn xxxx xxxx 15 0 mmmm mmmm: register direct nnnn: register direct add rm,rn mmmm: register direct nnnn: register indirect mov.l rm,@rn mmmm: register indirect with post- increment (multiply-and- accumulate operation) nnnn: * register indirect with post- increment (multiply-and- accumulate operation) mach,macl mac.w @rm+,@rn+ mmmm: register indirect with post- increment nnnn: register direct mov.l @rm+,rn mmmm: register direct nnnn: register indirect with pre-decrement mov.l rm,@?n mmmm: register direct nnnn: indexed register indirect mov.l rm,@(r0,rn) md format xxxx dddd 15 0 mmmm xxxx mmmmdddd: register indirect with displacement r0 (register direct) mov.b @(disp,rm),r0 nd4 format dddd nnnn xxxx 15 0 xxxx r0 (register direct) nnnndddd: register indirect with displacement mov.b r0,@(disp,rn)
28 table 2.3 instruction formats (cont) instruction format source operand destination operand instruction example nmd format nnnn xxxx dddd 15 0 mmmm mmmm: register direct nnnndddd: register indirect with displacement mov.l rm,@(disp,rn) mmmmdddd: register indirect with displacement nnnn: register direct mov.l @(disp,rm),rn d format dddd xxxx 15 0 xxxx dddd dddddddd: gbr indirect with displacement r0 (register direct) mov.l @(disp,gbr),r0 r0 (register direct) dddddddd: gbr indirect with displacement mov.l r0,@(disp,gbr) dddddddd: pc-relative with displacement r0 (register direct) mova @(disp,pc),r0 dddddddd: pc-relative bf label d12 format dddd xxxx 15 0 dddd dddd dddddddddddd: pc-relative bra label (label = disp + pc) nd8 format dddd nnnn xxxx 15 0 dddd dddddddd: pc-relative with displacement nnnn: register direct mov.l @(disp,pc),rn i format i i i i xxxx 15 0 xxxx i i i i iiiiiiii: immediate indexed gbr indirect and.b #imm, @(r0,gbr) iiiiiiii: immediate r0 (register direct) and #imm,r0 iiiiiiii: immediate trapa #imm ni format nnnn i i i i xxxx 15 0 i i i i iiiiiiii: immediate nnnn: register direct add #imm,rn note: in a multiply-and-accumulate instruction, nnnn is the source register.
29 2 . 4 instruction set 2.4.1 instruction set classified by function the sh7708 series instruction set includes 68 basic instruction types, as listed in table 2.4. table 2.4 classification of instructions classificati on types operatio n code function no. of instructio ns data transfer 5 mov data transfer 39 mova effective address transfer movt t bit transfer swap swap of upper and lower bytes xtrct extraction of middle of linked registers arithmetic 21 add binary addition 33 operations addc binary addition with carry addv binary addition with overflow check cmp/cond comparison div1 division div0s initialization of signed division div0u initialization of unsigned division dmuls signed double-precision multiplication dmulu unsigned double-precision multiplication dt decrement and test exts sign extension extu zero extension mac multiply-and-accumulate operation, double-precision multiply-and-accumulate operation
30 table 2.4 classification of instructions (cont) classificati on types operatio n code function no. of instructio ns arithmetic 21 mul double-precision multiplication 33 operations muls signed multiplication (cont) mulu unsigned multiplication neg negation negc negation with borrow sub binary subtraction subc binary subtraction with borrow subv binary subtraction with underflow check logic 6 and logical and 14 operations not bit inversion or logical or tas memory test and bit set tst logical and and t bit set xor exclusive or shift 12 rotl one-bit left rotation 16 rotr one-bit right rotation rotcl one-bit left rotation with t bit rotcr one-bit right rotation with t bit shal one-bit arithmetic left shift shar one-bit arithmetic right shift shll one-bit logical left shift shlln n-bit logical left shift shlr one-bit logical right shift shlrn n-bit logical right shift shad dynamic arithmetic shift shld dynamic logical shift
31 table 2.4 classification of instructions (cont) classificati on type s operatio n code function no. of instructio ns branch 9 bf conditional branch, delayed conditional branch (t = 0) 11 bt conditional branch, delayed conditional branch (t = 1) bra unconditional branch braf unconditional branch bsr branch to subroutine procedure bsrf branch to subroutine procedure jmp unconditional branch jsr branch to subroutine procedure rts return from subroutine procedure system 15 clrt t bit clear 75 control clrmac mac register clear clrs clear s bit ldc load to control register lds load to system register ldtlb load pte to tlb nop no operation pref prefetch data to cache rte return from exception handling sets set s bit sett set t bit sleep shift to power-down mode stc store from control register sts store from system register trapa trap exception handling total: 68 188 table 2.5 lists the sh7708 series instruction code formats.
32 table 2.5 instruction code format item format explanation instruction mnemonic op.sz src,dest op: operation code sz: size src: source dest: destination rm: source register rn: destination register imm: immediate data disp: displacement instruction code msb ? lsb mmmm: source register nnnn: destination register 0000: r0 0001: r1 ........... 1111: r15 iiii: immediate data dddd: displacement operation ? , ? (xx) m/q/t & | ~ <>n direction of transfer memory operand flag bits in sr logical and of each bit logical or of each bit exclusive or of each bit logical not of each bit n-bit shift privileged mode indicates whether privileged mode applies execution cycles value when no wait states are inserted the execution cycles listed in the table are minimums. the actual number of cycles may be increased in cases such as the following: 1. when contention occurs between instruction fetches and data access 2. when the destination register of the load instruction (memory ? register) and the register used by the next instruction are the same t bit value of t bit after instruction is executed ? no change note: scaling ( 1, 2, 4) is performed according to the instruction operand size.
33 table 2.6 lists the sh7708 series data transfer instructions table 2.6 data transfer instructions instruction operation code privileged mode cycles t bit mov #imm,rn imm ? sign extension ? rn 1110nnnniiiiiiii ? mov.w @(disp,pc),rn (disp 2 + pc) ? sign extension ? rn 1001nnnndddddddd ? mov.l @(disp,pc),rn (disp 4 + pc) ? rn 1101nnnndddddddd ? mov rm,rn rm ? rn 0110nnnnmmmm0011 ? mov.b rm,@rn rm ? (rn) 0010nnnnmmmm0000 ? mov.w rm,@rn rm ? (rn) 0010nnnnmmmm0001 ? mov.l rm,@rn rm ? (rn) 0010nnnnmmmm0010 ? mov.b @rm,rn (rm) ? sign extension ? rn 0110nnnnmmmm0000 ? mov.w @rm,rn (rm) ? sign extension ? rn 0110nnnnmmmm0001 ? mov.l @rm,rn (rm) ? rn 0110nnnnmmmm0010 ? mov.b rm,@?n rn? ? rn, rm ? (rn) 0010nnnnmmmm0100 ? mov.w rm,@?n rn? ? rn, rm ? (rn) 0010nnnnmmmm0101 ? mov.l rm,@?n rn? ? rn, rm ? (rn) 0010nnnnmmmm0110 ? mov.b @rm+,rn (rm) ? sign extension ? rn, rm + 1 ? rm 0110nnnnmmmm0100 ? mov.w @rm+,rn (rm) ? sign extension ? rn, rm + 2 ? rm 0110nnnnmmmm0101 ? mov.l @rm+,rn (rm) ? rn,rm + 4 ? rm 0110nnnnmmmm0110 ? mov.b r0,@(disp,rn) r0 ? (disp + rn) 10000000nnnndddd ? mov.w r0,@(disp,rn) r0 ? (disp 2 + rn) 10000001nnnndddd ? mov.l rm,@(disp,rn) rm ? (disp 4 + rn) 0001nnnnmmmmdddd ? mov.b @(disp,rm),r0 (disp + rm) ? sign extension ? r0 10000100mmmmdddd ? mov.w @(disp,rm),r0 (disp 2 + rm) ? sign extension ? r0 10000101mmmmdddd ? mov.l @(disp,rm),rn (disp 4 + rm) ? rn 0101nnnnmmmmdddd ? mov.b rm,@(r0,rn) rm ? (r0 + rn) 0000nnnnmmmm0100 ? mov.w rm,@(r0,rn) rm ? (r0 + rn) 0000nnnnmmmm0101 ?
34 table 2.6 data transfer instructions (cont) instruction operation code privileged mode cycles t bit mov.l rm,@(r0,rn) rm ? (r0 + rn) 0000nnnnmmmm0110 ? mov.b @(r0,rm),rn (r0 + rm) ? sign extension ? rn 0000nnnnmmmm1100 ? mov.w @(r0,rm),rn (r0 + rm) ? sign extension ? rn 0000nnnnmmmm1101 ? mov.l @(r0,rm),rn (r0 + rm) ? rn 0000nnnnmmmm1110 ? mov.b r0,@(disp,gbr) r0 ? (disp + gbr) 11000000dddddddd ? mov.w r0,@(disp,gbr) r0 ? (disp 2 + gbr) 11000001dddddddd ? mov.l r0,@(disp,gbr) r0 ? (disp 4 + gbr) 11000010dddddddd ? mov.b @(disp,gbr),r0 (disp + gbr) ? sign extension ? r0 11000100dddddddd ? mov.w @(disp,gbr),r0 (disp 2 + gbr) ? sign extension ? r0 11000101dddddddd ? mov.l @(disp,gbr),r0 (disp 4 + gbr) ? r0 11000110dddddddd ? mova @(disp,pc),r0 disp 4 + pc ? r0 11000111dddddddd ? movt rn t ? rn 0000nnnn00101001 ? swap.b rm,rn rm ? swap the bottom two bytes ? rn 0110nnnnmmmm1000 ? swap.w rm,rn rm ? swap two consecutive words ? rn 0110nnnnmmmm1001 ? xtrct rm,rn rm: middle 32 bits of rn ? rn 0010nnnnmmmm1101 ?
35 table 2.7 lists the sh7708 series arithmetic instructions. table 2.7 arithmetic instructions instruction operation code privileged mode cycles t bit add rm,rn rn + rm ? rn 0011nnnnmmmm1100 ? add #imm,rn rn + imm ? rn 0111nnnniiiiiiii ? addc rm,rn rn + rm + t ? rn, carry ? t 0011nnnnmmmm1110 1 carry addv rm,rn rn + rm ? rn, overflow ? t 0011nnnnmmmm1111 1 overflow cmp/eq #imm,r0 if r0 = imm, 1 ? t 10001000iiiiiiii 1 comparison result cmp/eq rm,rn if rn = rm, 1 ? t 0011nnnnmmmm0000 1 comparison result cmp/hs rm,rn if rn 3 rm with unsigned data, 1 ? t 0011nnnnmmmm0010 1 comparison result cmp/ge rm,rn if rn 3 rm with signed data, 1 ? t 0011nnnnmmmm0011 1 comparison result cmp/hi rm,rn if rn > rm with unsigned data, 1 ? t 0011nnnnmmmm0110 1 comparison result cmp/gt rm,rn if rn > rm with signed data, 1 ? t 0011nnnnmmmm0111 1 comparison result cmp/pz rn if rn 3 0, 1 ? t 0100nnnn00010001 1 comparison result cmp/pl rn if rn > 0, 1 ? t 0100nnnn00010101 1 comparison result cmp/str rm,rn if rn and rm have an equivalent byte, 1 ? t 0010nnnnmmmm1100 1 comparison result div1 rm,rn single-step division (rn/rm) 0011nnnnmmmm0100 1 calculation result div0s rm,rn msb of rn ? q, msb of rm ? m, m^ q ? t 0010nnnnmmmm0111 1 calculation result div0u 0 ? m/q/t 0000000000011001 ?0
36 table 2.7 arithmetic instructions (cont) instruction operation code privileged mode cycles t bit dmuls.lrm,rn signed operation of rn rm ? mach, macl 32 32 ? 64 bits 0011nnnnmmmm1101 2(?)* dmulu.lrm,rn unsigned operation of rn rm ? mach, macl 32 32 ? 64 bits 0011nnnnmmmm0101 2(?)* dt rn rn ?1 ? rn, if rn = 0, 1 ? t, else 0 ? t 0100nnnn00010000 1 comparison result exts.b rm,rn a byte in rm is sign- extended ? rn 0110nnnnmmmm1110 ? exts.w rm,rn a word in rm is sign- extended ? rn 0110nnnnmmmm1111 ? extu.b rm,rn a byte in rm is zero- extended ? rn 0110nnnnmmmm1100 ? extu.w rm,rn a word in rm is zero- extended ? rn 0110nnnnmmmm1101 ? mac.l @rm+,@rn+ signed operation of (rn) (rm) + mac ? mac, rn + 4 ? rn, rm + 4 ? rm 32 32 + 64 ? 64 bits 0000nnnnmmmm1111 2(?)* mac.w @rm+,@rn+ signed operation of (rn) (rm) + mac ? mac, rn + 2 ? rn, rm + 2 ? rm 16 16 + 64 ? 64 bits 0100nnnnmmmm1111 2(?)* mul.l rm,rn rn rm ? macl 32 32 ? 32 bits 0000nnnnmmmm0111 2(?)* muls.w rm,rn signed operation of rn rm ? mac 16 16 ? 32 bits 0010nnnnmmmm1111 1(?)* mulu.w rm,rn unsigned operation of rn rm ? mac 16 16 ? 32 bits 0010nnnnmmmm1110 1(?)*
37 table 2.7 arithmetic instructions (cont) instruction operation code privileged mode cycles t bit neg rm,rn 0?m ? rn 0110nnnnmmmm1011 ? negc rm,rn 0?m? ? rn, borrow ? t 0110nnnnmmmm1010 1 borrow sub rm,rn rn?m ? rn 0011nnnnmmmm1000 ? subc rm,rn rn?m? ? rn, borrow ? t 0011nnnnmmmm1010 1 borrow subv rm,rn rn?m ? rn, underflow ? t 0011nnnnmmmm1011 1 underflow note: the normal number of execution cycles is shown. the value in parentheses is the number of cycles required in case of contention with the preceding or following instruction.
38 table 2.8 lists the sh7708 series logic operation instructions. table 2.8 logic operation instructions instruction operation code privileged mode cycles t bit and rm,rn rn & rm ? rn 0010nnnnmmmm1001 ? and #imm,r0 r0 & imm ? r0 11001001iiiiiiii ? and.b #imm,@(r0,gbr) (r0 + gbr) & imm ? (r0 + gbr) 11001101iiiiiiii ? not rm,rn ~rm ? rn 0110nnnnmmmm0111 ? or rm,rn rn | rm ? rn 0010nnnnmmmm1011 ? or #imm,r0 r0 | imm ? r0 11001011iiiiiiii ? or.b #imm,@(r0,gbr) (r0 + gbr) | imm ? (r0 + gbr) 11001111iiiiiiii ? tas.b @rn if (rn) is 0, 1 ? t; 1 ? msb of (rn) 0100nnnn00011011 3 test result tst rm,rn rn & rm; if the result is 0, 1 ? t 0010nnnnmmmm1000 1 test result tst #imm,r0 r0 & imm; if the result is 0, 1 ? t 11001000iiiiiiii 1 test result tst.b #imm,@(r0,gbr) (r0 + gbr) & imm; if the result is 0, 1 ? t 11001100iiiiiiii 3 test result xor rm,rn rn ^ rm ? rn 0010nnnnmmmm1010 ? xor #imm,r0 r0 ^ imm ? r0 11001010iiiiiiii ? xor.b #imm,@(r0,gbr) (r0 + gbr) ^ imm ? (r0 + gbr) 11001110iiiiiiii ?
39 table 2.9 lists the sh7708 series shift instructions. table 2.9 shift instructions instruction operation code privileged mode cycles t bit rotl rn t ? rn ? msb 0100nnnn00000100 1 msb rotr rn lsb ? rn ? t 0100nnnn00000101 1 lsb rotcl rn t ? rn ? t 0100nnnn00100100 1 msb rotcr rn t ? rn ? t 0100nnnn00100101 1 lsb shad rm,rn rn 3 0: rn << rm ? rn rn < 0: rn >> rm ? [msb ? rn] 0100nnnnmmmm1100 ? shal rn t ? rn ? 0 0100nnnn00100000 1 msb shar rn msb ? rn ? t 0100nnnn00100001 1 lsb shld rm,rn rn 3 0: rn << rm ? rn rn < 0: rn >> rm ? [0 ? rn] 0100nnnnmmmm1101 ? shll rn t ? rn ? 0 0100nnnn00000000 1 msb shlr rn 0 ? rn ? t 0100nnnn00000001 1 lsb shll2 rn rn << 2 ? rn 0100nnnn00001000 ? shlr2 rn rn >> 2 ? rn 0100nnnn00001001 ? shll8 rn rn << 8 ? rn 0100nnnn00011000 ? shlr8 rn rn >> 8 ? rn 0100nnnn00011001 ? shll16 rn rn << 16 ? rn 0100nnnn00101000 ? shlr16 rn rn >> 16 ? rn 0100nnnn00101001 ?
40 table 2.10 lists the sh7708 series branch instructions. table 2.10branch instructions instruction operation code privileged mode cycles t bit bf label if t = 0, disp 2 + pc pc; if t = 1, nop (where label is disp + pc) 10001011dddddddd 3/1* bf/s label delayed branch, if t = 0, disp 2 + pc ? pc; if t = 1, nop 10001111dddddddd 2/1* bt label delayed branch, if t = 1, disp 2 + pc ? pc; if t = 0, nop 10001001dddddddd 3/1* bt/s label if t = 1, disp 2 + pc ? pc; if t = 0, nop 10001101dddddddd 2/1* bra label delayed branch, disp 2 + pc ? pc 1010dddddddddddd ? braf rm delayed branch, rm + pc ? pc 0000mmmm00100011 ? bsr label delayed branch, pc ? pr, disp 2 + pc ? pc 1011dddddddddddd ? bsrf rm delayed branch, pc ? pr, rm + pc ? pc 0000mmmm00000011 ? jmp @rm delayed branch, rm ? pc 0100mmmm00101011 ? jsr @rm delayed branch, pc ? pr, rm ? pc 0100mmmm00001011 ? rts delayed branch, pr ? pc 0000000000001011 ? note: one state when there is no branch.
41 table 2.11 lists the sh7708 series system control instructions. table 2.11system control instructions instruction operation code privileged mode cycles t bit clrmac 0 ? mach, macl 0000000000101000 ? clrs 0 ? s 0000000001001000 ? clrt 0 ? t 0000000000001000 ?0 ldc rm,sr rm ? sr 0100mmmm00001110 ? 5 lsb ldc rm,gbr rm ? gbr 0100mmmm00011110 ? ldc rm,vbr rm ? vbr 0100mmmm00101110 ? 1 ldc rm,ssr rm ? ssr 0100mmmm00111110 ? 1 ldc rm,spc rm ? spc 0100mmmm01001110 ? 1 ldc rm,r0_bank rm ? r0_bank 0100mmmm10001110 ? 1 ldc rm,r1_bank rm ? r1_bank 0100mmmm10011110 ? 1 ldc rm,r2_bank rm ? r2_bank 0100mmmm10101110 ? 1 ldc rm,r3_bank rm ? r3_bank 0100mmmm10111110 ? 1 ldc rm,r4_bank rm ? r4_bank 0100mmmm11001110 ? 1 ldc rm,r5_bank rm ? r5_bank 0100mmmm11011110 ? 1 ldc rm,r6_bank rm ? r6_bank 0100mmmm11101110 ? 1 ldc rm,r7_bank rm ? r7_bank 0100mmmm11111110 ? 1 ldc.l @rm+,sr (rm) ? sr, rm + 4 ? rm 0100mmmm00000111 ? 7 lsb ldc.l @rm+,gbr (rm) ? gbr, rm + 4 ? rm 0100mmmm00010111 ? ldc.l @rm+,vbr (rm) ? vbr, rm + 4 ? rm 0100mmmm00100111 ? 1 ldc.l @rm+,ssr (rm) ? ssr, rm + 4 ? rm 0100mmmm00110111 ? 1 ldc.l @rm+,spc (rm) ? spc, rm + 4 ? rm 0100mmmm01000111 ? 1 ldc.l @rm+, r0_bank (rm) ? r0_bank, rm + 4 ? rm 0100mmmm10000111 ? 1 ldc.l @rm+, r1_bank (rm) ? r1_bank, rm + 4 ? rm 0100mmmm10010111 ? 1 ldc.l @rm+, r2_bank (rm) ? r2_bank, rm + 4 ? rm 0100mmmm10100111 ? 1 ldc.l @rm+, r3_bank (rm) ? r3_bank, rm + 4 ? rm 0100mmmm10110111 ? 1
42 table 2.11system control instructions (cont) instruction operation code privileged mode cycles t bit ldc.l @rm+, r4_bank (rm) ? r4_bank, rm + 4 ? rm 0100mmmm11000111 ? 1 ldc.l @rm+, r5_bank (rm) ? r5_bank, rm + 4 ? rm 0100mmmm11010111 ? 1 ldc.l @rm+, r6_bank (rm) ? r6_bank, rm + 4 ? rm 0100mmmm11100111 ? 1 ldc.l @rm+, r7_bank (rm) ? r7_bank, rm + 4 ? rm 0100mmmm11110111 ? 1 lds rm,mach rm ? mach 0100mmmm00001010 ? lds rm,macl rm ? macl 0100mmmm00011010 ? lds rm,pr rm ? pr 0100mmmm00101010 ? lds.l @rm+,mach (rm) ? mach, rm + 4 ? rm 0100mmmm00000110 ? lds.l @rm+,macl (rm) ? macl, rm + 4 ? rm 0100mmmm00010110 ? lds.l @rm+,pr (rm) ? pr, rm + 4 ? rm 0100mmmm00100110 ? ldtlb pteh/ptel ? tlb 0000000000111000 ? 1 nop no operation 0000000000001001 ? pref @rm (rm) ? cache 0000mmmm10000011 1 rte delayed branch, ssr/spc ? sr/pc 0000000000101011 ? 4 sets 1 ? s 0000000001011000 ? sett 1 ? t 0000000000011000 ?1 sleep sleep 0000000000011011 ? 4* stc sr,rn sr ? rn 0000nnnn00000010 ? 1 stc gbr,rn gbr ? rn 0000nnnn00010010 ? stc vbr,rn vbr ? rn 0000nnnn00100010 ? 1 stc ssr,rn ssr ? rn 0000nnnn00110010 ? 1 stc spc,rn spc ? rn 0000nnnn01000010 ? 1 stc r0_bank,rn r0_bank ? rn 0000nnnn10000010 ? 1 stc r1_bank,rn r1_bank ? rn 0000nnnn10010010 ? 1 stc r2_bank,rn r2_bank ? rn 0000nnnn10100010 ? 1 stc r3_bank,rn r3_bank ? rn 0000nnnn10110010 ? 1 note: the number of cycles until the sleep state is entered.
43 table 2.11system control instructions (cont) instruction operation code privileged mode cycles t bit stc r4_bank,rn r4_bank ? rn 0000nnnn11000010 ? 1 stc r5_bank,rn r5_bank ? rn 0000nnnn11010010 ? 1 stc r6_bank,rn r6_bank ? rn 0000nnnn11100010 ? 1 stc r7_bank,rn r7_bank ? rn 0000nnnn11110010 ? 1 stc.l sr,@?n rn? ? rn, sr ? (rn) 0100nnnn00000011 ? 1 stc.l gbr,@?n rn? ? rn, gbr ? (rn) 0100nnnn00010011 ? stc.l vbr,@?n rn? ? rn, vbr ? (rn) 0100nnnn00100011 ? 1 stc.l ssr,@?n rn? ? rn, ssr ? (rn) 0100nnnn00110011 ? 1 stc.l spc,@?n rn? ? rn, spc ? (rn) 0100nnnn01000011 ? 1 stc.l r0_bank, @?n rn? ? rn, r0_bank ? (rn) 0100nnnn10000011 ? 2 stc.l r1_bank, @?n rn? ? rn, r1_bank ? (rn) 0100nnnn10010011 ? 2 stc.l r2_bank, @?n rn? ? rn, r2_bank ? (rn) 0100nnnn10100011 ? 2 stc.l r3_bank, @?n rn? ? rn, r3_bank ? (rn) 0100nnnn10110011 ? 2 stc.l r4_bank, @?n rn? ? rn, r4_bank ? (rn) 0100nnnn11000011 ? 2 stc.l r5_bank, @?n rn? ? rn, r5_bank ? (rn) 0100nnnn11010011 ? 2 stc.l r6_bank, @?n rn? ? rn, r6_bank ? (rn) 0100nnnn11100011 ? 2 stc.l r7_bank, @?n rn? ? rn, r7_bank ? (rn) 0100nnnn11110011 ? 2 sts mach,rn mach ? rn 0000nnnn00001010 ? sts macl,rn macl ? rn 0000nnnn00011010 ? sts pr,rn pr ? rn 0000nnnn00101010 ? sts.l mach,@?n rn? ? rn, mach ? (rn) 0100nnnn00000010 ? sts.l macl,@?n rn? ? rn, macl ? (rn) 0100nnnn00010010 ? sts.l pr,@?n rn? ? rn, pr ? (rn) 0100nnnn00100010 ? trapa #imm pc ? spc, sr ? ssr, imm ? tra 11000011iiiiiiii ?
44 notes: 1. the table shows the minimum number of execution cycles. the actual number of instruction execution cycles will increase in cases such as the following: when there is contention between an instruction fetch and data access when the destination register in a load (memory-to-register) instruction is also used by the next instruction 2. with the addressing modes using displacement (disp) listed below, the assembler descriptions in this manual show the value before scaling ( 1, 2, or 4) is performed. this is done to clarify the operation of the chip. for the actual assembler descriptions, refer to the individual assembler notation rules. @ (disp:4, rn) ; register-indirect with displacement @ (disp:8, rn) ; gbr-indirect with displacement @ (disp:8, pc) ; pc-relative with displacement disp:8, disp:12 ; pc-relative
45 2.4.2 instruction code map table 2.12 shows the instruction code map. table 2.12 instruction code map instruction code fx: 0000 fx: 0001 fx: 0010 fx: 0011 to 1111 msb lsb md: 00 md: 01 md: 10 md: 11 0000 rn fx 0000 0000 rn fx 0001 0000 rn 00md 0010 stc sr,rn stc gbr,rn stc vbr,rn stc ssr,rn 0000 rn 01md 0010 stc spc,rn 0000 rn 10md 0010 stc r0_bank,rn stc r1_bank,rn stc r2_bank,rn stc r3_bank,rn 0000 rn 11md 0010 stc r4_bank,rn stc r5_bank,rn stc r6_bank,rn stc r7_bank,rn 0000 rm 00md 0011 bsrf rm braf rm 0000 rm 10md 0011 pref @rm 0000 rn rm 01md mov.b rm,@(r0,rn) mov.w rm,@(r0,rn) mov.l rm,@(r0,rn) mul.l rm,rn 0000 0000 00md 1000 clrt sett clrmac ldtlb 0000 0000 01md 1000 clrs sets 0000 0000 fx 1001 nop div0u 0000 0000 fx 1010 0000 0000 fx 1011 rts sleep rte 0000 rn fx 1000 0000 rn fx 1001 movt rn 0000 rn fx 1010 sts mach,rn sts macl,rn sts pr,rn 0000 rn fx 1011 0000 rn rm 11md mov.b @(r0,rm),rn mov.w @(r0,rm),rn mov.l @(r0,rm),rn mac.l @rm+,@rn+ 0001 rn rm disp mov.l rm,@(disp:4,rn) 0010 rn rm 00md mov.b rm,@rn mov.w rm,@rn mov.l rm,@rn 0010 rn rm 01md mov.b rm,@-rn mov.w rm,@-rn mov.l rm,@-rn div0s rm,rn 0010 rn rm 10md tst rm,rn and rm,rn xor rm,rn or rm,rn 0010 rn rm 11md cmp/str rm,rn xtrct rm,rn mulu.w rm,rn mulsw rm,rn 0011 rn rm 00md cmp/eq rm,rn cmp/hs rm,rn cmp/ge rm,rn 0011 rn rm 01md div1 rm,rn dmulu.l rm,rn cmp/hi rm,rn cmp/gt rm,rn 0011 rn rm 10md sub rm,rn subc rm,rn subv rm,rn 0011 rn rm 11md add rm,rn dmuls.l rm,rn addc rm,rn addv rm,rn
46 table 2.12 instruction code map (cont) instruction code fx: 0000 fx: 0001 fx: 0010 fx: 0011 to 1111 msb lsb md: 00 md: 01 md: 10 md: 11 0100 rn fx 0000 shll rn dt rn shal rn 0100 rn fx 0001 shlr rn cmp/pz rn shar rn 0100 rn fx 0010 sts.l mach,@-rn sts.l macl,@-rn sts.l pr,@-rn 0100 rn 00md 0011 stc.l sr,@-rn stc.l gbr,@-rn stc.l vbr,@-rn stc.l ssr,@-rn 0100 rn 01md 0011 stc.l spc,@-rn 0100 rn 10md 0011 stc.l r0_bank,@-rn stc.l r1_bank,@-rn stc.l r2_bank,@-rn stc.l r3_bank,@-rn 0100 rn 11md 0011 stc.l r4_bank,@-rn stc.l r5_bank,@-rn stc.l r6_bank,@-rn stc.l r7_bank,@-rn 0100 rn fx 0100 rotl rn rotcl rn 0100 rn fx 0101 rotr rn cmp/pl rn rotcr rn 0100 rm fx 0110 lds.l @rm+,mach lds.l @rm+,macl lds.l @rm+,pr 0100 rm 00md 0111 ldc.l @rm+,sr ldc.l @rm+,gbr ldc.l @rm+,vbr ldc.l @rm+,ssr 0100 rm 01md 0111 ldc.l @rm+,spc 0100 rm 10md 0111 ldc.l @rm+,r0_bank ldc.l @rm+,r1_bank ldc.l @rm+,r2_bank ldc.l @rm+,r3_bank 0100 rm 11md 0111 ldc.l @rm+,r4_bank ldc.l @rm+,r5_bank ldc.l @rm+,r6_bank ldc.l @rm+,r7_bank 0100 rn fx 1000 shll2 rn shll8 rn shll16 rn 0100 rn fx 1001 shlr2 rn shlr8 rn shlr16 rn 0100 rm fx 1010 lds rm,mach lds rm,macl lds rm,pr 0100 rm/ rn fx 1011 jsr @rm tas.b @rn jmp @rm 0100 rn rm 1100 shad rm,rn 0100 rn rm 1101 shld rm,rn 0100 rm 00md 1110 ldc rm,sr ldc rm,gbr ldc rm,vbr ldc rm,ssr 0100 rm 01md 1110 ldc rm,spc 0100 rm 10md 1110 ldc rm,r0_bank ldc rm,r1_bank ldc rm,r2_bank ldc rm,r3_bank 0100 rm 11md 1110 ldc rm,r4_bank ldc rm,r5_bank ldc rm,r6_bank ldc rm,r7_bank 0100 rn rm 1111 mac.w @rm+,@rn+ 0101 rn rm disp mov.l @(disp:4,rm),rn 0110 rn rm 00md mov.b @rm,rn mov.w @rm,rn mov.l @rm,rn mov rm,rn 0110 rn rm 01md mov.b @rm+,rn mov.w @rm+,rn mov.l @rm+,rn not rm,rn 0110 rn rm 10md swap.b rm,rn swap.w rm,rn negc rm,rn neg rm,rn 0110 rn rm 11md extu.b rm,rn extu.w rm,rn exts.b rm,rn exts.w rm,rn 0111 rn imm add #imm:8,rn
47 table 2.12 instruction code map (cont) instruction code fx: 0000 fx: 0001 fx: 0010 fx: 0011 to 1111 msb lsb md: 00 md: 01 md: 10 md: 11 1000 00md rn disp mov.b r0,@(disp:4,rn) mov.w r0,@(disp:4,rn) 1000 01md rm disp mov.b @(disp:4,rm),r0 mov.w @(disp:4,rm),r0 1000 10md imm/disp cmp/eq #imm:8,r0 bt label:8 bf label:8 1000 11md imm/disp bt/s label:8 bf/s label:8 1001 rn disp mov.w @(disp:8,pc),rn 1010 disp bra label:12 1011 disp bsr label:12 1100 00md imm/disp mov.b r0,@(disp:8,gbr) mov.w r0,@(disp:8,gbr) mov.l r0,@(disp:8,gbr) trapa #imm:8 1100 01md disp mov.b @(disp:8,gbr),r0 mov.w @(disp:8,gbr),r0 mov.l @(disp:8,gbr),r0 mova @(disp:8,pc),r0 1100 10md imm tst #imm:8,r0 and #imm:8,r0 xor #imm:8,r0 or #imm:8,r0 1100 11md imm tst.b #imm:8,@(r0,gbr) and.b #imm:8,@(r0,gbr) xor.b #imm:8,@(r0,gbr) or.b #imm:8,@(r0,gbr) 1101 rn disp mov.l @(disp:8,pc),rn 1110 rn imm mov #imm:8,rn 1111 ************ note: see the sh-3/sh-3e/sh3-dsp programming manual for details.
48 2 . 5 processor states and processor modes 2.5.1 processor states the sh7708 series has five processor states: the reset state, exception-handling state, bus-released state, program execution state, and power-down state. reset state: in this state the cpu is reset. the reset state is entered when the reset pin goes low. the cpu enters the power-on reset state if the breq pin is high, or the manual reset state if the breq pin is low. see section 4, exception handling, for more information on resets. in the power-on reset state, the internal states of the cpu and the on-chip supporting module registers are initialized. in the manual reset state, the internal states of the cpu and registers of on- chip supporting modules other than the bus state controller (bsc) are initialized. since the bsc is not initialized in the manual reset state, refreshing operations continue. refer to the register configurations in the relevant sections for further details. exception-handling state: this is a transient state during which the cpu? processor state flow is altered by a reset, general exception, or interrupt exception handling. in the case of a reset, the cpu branches to address h'a0000000 and starts executing the user-coded exception handling program. in the case of a general exception or interrupt, the program counter (pc) contents are saved in the saved program counter (spc) and the status register (sr) contents are saved in the saved status register (ssr). the cpu branches to the start address of the user-coded exception service routine found from the sum of the contents of the vector base address and the vector offset. see section 4, exception processing, for more information on resets, general exceptions, and interrupts. program execution state: in this state the cpu executes program instructions in sequence. power-down state: in the power-down state, cpu operation halts and power consumption is reduced. the power-down state is entered by means of the sleep instruction or the ca pin*. there are three modes in the power-down state: sleep mode, standby mode and hardware standby mode. see section 8, power-down modes, for more information. note:sh7708s,sh7708r only bus-released state: in this state the cpu has released the bus to a device that requested it. transitions between the states are shown in figure 2.8.
49 from any state except hardware standby mode when reset = 0 and breq = 1 from any state except hardware standby mode when reset = 0 and breq = 0 reset = 1, breq = 1 reset = 1, breq = 0 reset = 0, breq = 1 power-on reset state manual reset state program execution state note: driving the ca pin low in any state will cause a transition to hardware standby mode (sh7708s,sh7708r only). bus-released state sleep mode standby mode exception-handling state hardware standby mode* interrupt bus request bus request clearance exception interrupt end of exception transition processing bus request bus request clearance sleep instruction with stby bit set interrupt reset state power-down state ca = 1, reset = 0, breq = 1 sleep instruction with stby bit cleared bus request bus request clearance figure 2.8 processor state transitions 2.5.2 processor modes there are two processor modes: privileged mode and user mode. the processor mode is determined by the processor mode bit (md) in the status register (sr). user mode is selected when the md bit is 0, and privileged mode when the md bit is 1. when the reset state or exception state is entered, the md bit is set to 1. when exception handling ends, the md bit is cleared to 0 and user mode is entered. there are certain registers and bits which can only be accessed in privileged mode.
50
51 section 3 memory management unit (mmu) 3 . 1 overview 3.1.1 features the sh7708 series has an on-chip memory management unit (mmu) that implements address translation. the sh7708 series features a resident translation lookaside buffer (tlb) that caches information for user-created address translation tables located in external memory. it enables high- speed translation of virtual addresses into physical addresses. address translation uses the paging system and supports two page sizes (1 kbyte and 4 kbytes). the access right to virtual address space can be set for privileged and user modes to provide memory protection. 3.1.2 role of mmu the mmu is a feature designed to make efficient use of physical memory. as shown in figure 3.1, if a process is smaller in size than the physical memory, the entire process can be mapped onto physical memory. however, if the process increases in size to the extent that it no longer fits into physical memory, it becomes necessary to partition the process and to map those parts requiring execution onto memory as occasion demands ((1)). having the process itself consider this mapping onto physical memory would impose a large burden on the process. to lighten this burden, the idea of virtual memory was born as a means of performing en bloc mapping onto physical memory ((2)). in a virtual memory system, substantially more virtual memory than physical memory is provided, and the process is mapped onto this virtual memory. thus a process only has to consider operation in virtual memory. mapping from virtual memory to physical memory is handled by the mmu. the mmu is normally controlled by the operating system, switching physical memory to allow the virtual memory required by a process to be mapped onto physical memory in a smooth fashion. switching of physical memory is carried out via secondary storage, etc. the virtual memory system that came into being in this way is particularly effective in a time- sharing system (tss) in which a number of processes are running simultaneously ((3)). if processes running in a tss had to take mapping onto virtual memory into consideration while running, it would not be possible to increase efficiency. virtual memory is thus used to reduce this load on the individual processes and so improve efficiency ((4)). in the virtual memory system, virtual memory is allocated to each process. the task of the mmu is to perform efficient mapping of these virtual memory areas onto physical memory. it also has a memory protection feature that prevents one process from inadvertently accessing another process? physical memory. when address translation from virtual memory to physical memory is performed using the mmu, it may happen that the relevant translation information is not recorded in the mmu, with the result that one process may inadvertently access the virtual memory allocated to another process. in
52 this case, the mmu will generate an exception, change the physical memory mapping, and record the new address translation information. although the functions of the mmu could also be implemented by software alone, the need for translation to be performed by software each time a process accesses physical memory would result in poor efficiency. for this reason, a buffer for address translation (translation lookaside buffer: tlb) is provided in hardware to hold frequently used address translation information. the tlb can be described as a cache for storing address translation information. unlike cache memory, however, if address translation fails?hat is, if an exception is generated?witching of address translation information is normally performed by software. this makes it possible for memory management to be performed flexibly by software. the mmu has two methods of mapping from virtual memory to physical memory: a paging method using fixed-length address translation, and a segment method using variable-length address translation. with the paging method, the unit of translation is a fixed-size address space (usually of 1 to 64 kbytes) called a page. in the following text, sh7708 series address space in virtual memory is referred to as virtual address space, and address space in physical memory as physical memory space. process 1 physical memory mmu (1) (2) (3) (4) process 1 physical memory process 1 virtual memory mmu physical memory process 1 process 2 process 3 physical memory process 1 process 2 process 3 virtual memory physical memory figure 3.1 mmu functions
53 3.1.3 sh7708 series mmu virtual address map: the sh7708 series uses 32-bit virtual addresses to access a 4-gbyte virtual address space that is divided into several areas. address space mapping is shown in figure 3.2. in privileged mode, there are five areas, p0?4. the p0 and p3 areas are mapped onto physical address space in page units, in accordance with address translation table information. addresses h'7f000000?'7fffffff in the p0 area can be used as on-chip ram space by making a setting in the cache control register (ccr) (see section 5, cache). in this case, mapping by means of the address translation table is not performed for the on-chip ram space. write-back or write-through can be selected for write access by means of a ccr setting. mapping of the p1 area is fixed to physical address space (h'00000000 to h'1fffffff). in the p1 area, setting a virtual address msbs (bit 31) to 0 generates the corresponding physical address. p1 area access can be cached, and the cache control register (ccr) is set to indicate whether to cache or not. write access is processed as write-through (sh7708). a ccr setting can be made to select write-back or write-through. mapping of the p2 area is fixed to physical address space (h'00000000 to h'1fffffff). in the p2 area, setting the top three virtual address bits (bits 31, 30, and 29) to 0 generates the corresponding physical address. p2 area access cannot be cached. the p1 and p2 areas are not mapped by the address translation table, so the tlb is not used and no exceptions like tlb misses occur. initialization of mmu-related registers, exception processing handling, and the like are located in the p1 and p2 areas. because the p1 area is cached, handlers that require high-speed processing are placed there. the p4 area is used for mapping on-chip control register addresses. in user mode, the 2 gbytes of virtual address space from h'00000000 to h'7fffffff (area u0) can be accessed. u0 is mapped onto physical address space in page units. as with the p0 area, addresses h'7000000?'7fffffff can be used as on-chip ram space by making a setting in the cache control register (ccr). in this case, mapping by means of the address translation table is not performed for the on-chip ram space. the 2 gbytes of virtual address space from h'80000000 to h'ffffffff cannot be accessed in user mode. attempting to do so creates an address error. write-back or write-through mode can be selected for write accesses by means of a ccr setting.
54 h'80000000 h'a0000000 h'c0000000 h'e0000000 h'ffffffff 2 gbyte virtual space, cacheable (write-back/write-through) 2 gbyte virtual space, cacheable (write-back/write-through) address error h'00000000 h'00000000 h'80000000 h'ffffffff area p0 area p1 area p2 area p3 area p4 area u0 privileged mode user mode h'7f000000 h'7f000000 on-chip ram space 0.5 gbyte fixed physical space, cacheable (write-through: sh7708) 0.5 gbyte fixed physical space, non-cacheable 0.5 gbyte virtual space, cacheable (write-back/write-through) 0.5 gbyte control space, non-cacheable on-chip ram space (write-back/write-through: sh7708s, sh7708r) figure 3.2 virtual address space mapping
55 physical address space: the sh7708 series supports a 32-bit physical address space, but the upper 3 bits are actually ignored and treated as a shadow. see section 10, bus state controller, for details. single address translation: when the mmu is enabled, the virtual address space is divided into units called pages. physical addresses are translated in page units. address translation tables in external memory hold information such as the physical address that corresponds to the virtual address and memory protection codes. with the tlb, the contents of address translation tables in external memory are cached to speed up address translation. when an access to areas p1 or p2 occurs, there is no tlb access and the physical address is defined uniquely by the hardware. if it belongs to areas p0, p3 or u0, the tlb is searched by virtual address and, if that virtual address is registered in the tlb, the access hits the tlb. the corresponding physical address and the page control information are read from the tlb and the physical address is determined. if the virtual address is not registered in the tlb, a tlb miss exception occurs and processing will shift to the tlb miss handler. in the tlb miss handler, the tlb address translation table in external memory is searched and the corresponding physical address and the page control information are registered in the tlb. after returning from the handler, the instruction that caused the tlb miss is re-executed. when the mmu is enabled, address translation information that results in a physical address space of h'80000000?'ffffffff should not be registered in the tlb. when the mmu is disabled, the virtual address is used directly as the physical address. as the sh7708 series supports a 29-bit address space as the physical address space, the top 3 bits of the physical address are ignored, and constitute a shadow space (see section 10, bus state controller (bsc)). for example, addresses h'00001000 in the p0 area, h'80001000 in the p1 area, h'a0001000 in the p2 area, and h'c0001000 in the p3 area are all mapped onto the same physical address. when access to these addresses is performed with the cache enabled, an address with the top 3 bits of the physical address masked to 0 is stored in the cache address array to ensure data congruity. single virtual memory mode and multiple virtual memory mode: there are two virtual memory modes: single virtual memory mode and multiple virtual memory mode. in single virtual memory mode, multiple processes run in parallel using the virtual address space exclusively and the physical address corresponding to a given virtual address is specified uniquely. in multiple virtual memory mode, multiple processes run in parallel sharing the virtual address space, so a given virtual address may be translated into different physical addresses depending on the process. either single or multiple virtual mode is selected according to the value set in the mmu control register. the items used in address comparison are the vpn and asid. the vpn of the virtual address used to access external memory is compared with the vpn of the tlb entry selected by the index number.
56 address space identifier (asid): when multiple processes run in parallel sharing the same virtual address space and the processes have unique address translation tables, the virtual space can be multiplexed. the asid is 8 bits in length and is held in pteh within the mmu indicating the current process. with asid, the tlb need not be purged when the process is switched. when multiple processes run in parallel using the virtual address space exclusively, the physical address corresponding to a given virtual address is specified uniquely. for this kind of single virtual memory, the asid becomes a key to protect memory (see section 3.4.2). 3.1.4 register configuration a register that has an undefined initial value must be initialized by the software. table 3.1 shows the configuration of the mmu control registers. table 3.1 register configuration name abbreviatio n r/ w size initial value* 1 address page table entry register high pteh r/w longword undefined h'fffffff0 page table entry register low ptel r/w longword undefined h'fffffff4 translation table base register ttb r/w longword undefined h'fffffff8 tlb exception address register tea r/w longword undefined h'fffffffc mmu control register mmucr r/w longword * 2 h'ffffffe0 notes: 1. initialized by a power-on reset or manual reset. 2. sv bit: undefined other bits: 0
57 3 . 2 register description there are five registers for mmu processing. these are all peripheral module registers, so they are located in address space area p4 and can only be accessed from privileged mode by specifying the address. these registers consist of: 1. the page table entry register high (pteh) register residing at address h'fffffff0, which consists of a virtual page number (vpn) and asid. the vpn set is the vpn of the virtual address at which the exception is generated in the case of an mmu exception or address error exception. when the page size is 4 kbytes, the vpn is the upper 20 bits of the virtual address, but in this case the upper 22 bits of the virtual address are set. the vpn can also be modified by software. as the asid, software sets the number of the currently executing process. the vpn and asid are recorded in the tlb by the ldtlb instruction. 2. the page table entry register low (ptel) register residing at address h'fffffff4, and used to store the physical page number and page management information to be recorded in the tlb by the ldtlb instruction. the contents of this register are only modified in response to a software command. 3. the translation table base register (ttb) residing at address h'fffffff8, which points to the base address of the current page table. the hardware does not set any value in ttb automatically. ttb is available to software for general purposes. 4. the tlb exception address register (tea) register residing at address h'fffffffc, which stores the virtual address corresponding to a tlb or address error exception. this value remains valid until the next exception or interrupt. 5. the mmu control register (mmucr) residing at address h'fffffff0, which makes the mmu settings described in figure 3.3. any program that modifies mmucr should reside in the p1 or p2 area.
58 the mmu registers are shown in figure 3.3. 31 7 vpn pteh ptel asid 0 ppn 0 10 31 6 4 3 2 1 0 10 31 ttb ttb 0 31 virtual address causing tlb-related or address error exception tea 0 pr sz c d 8 9 7 v 0 0 sh 0 mmucr 0 31 8 4 65 73210 sv rc 00 0 tf ix at 0: reserved bits (except mmucr): always read as 0. writing is ignored. (mmucr) :except bit 3 is read as 0. bit 3 is don't care. writing is should be 0. sv: single virtual memory mode bit. set to 1 for single virtual memory mode, cleared to 0 for multiple virtual memory mode. rc: a 2-bit random counter, automatically updated by hardware according to the following rules in the event of an mmu exception. when a tlb miss exception occurs, all tlb entry ways corresponding to the virtual address at which the exception occurred are checked, and if all ways are valid, 1 is added to rc; if there is one or more invalid way, they are set by priority from way 0, in the order: way 0, way 1, way 2, way 3. in the event of an mmu exception other than a tlb miss exception, the way which caused the exception is set in rc. tf: tlb flush bit. write 1 to flush the tlb (clear all valid bits of the tlb to 0). always reads 0. ix: index mode bit. when 0, vpn bits 16?2 are used as the tlb index number. when 1, the value obtained by ex-oring asid bits 4? in pteh and vpn bits 16?2 are used as the tlb index number. at: address translation bit. enables/disables the mmu. 0: mmu disabled figure 3.3 mmu register contents
59 3 . 3 tlb functions 3.3.1 configuration of the tlb the tlb caches address translation table information located in external memory. the address translation table stores the physical page number translated from the virtual page number and the control information for the page, which is the unit of address translation. figure 3.4 shows the overall tlb configuration. the tlb is 4-way set associative with 128 entries. there are 32 entries for each way. figure 3.5 shows the configuration of virtual addresses and tlb entries. entry 1 address array data array entry 0 entry 1 entry 31 way 0? way 0? vpn(11?0) vpn(31?7) asid(7?) v entry 0 entry 31 ppn(31?0) pr(1?) sz c d sh figure 3.4 overall configuration of the tlb
60 31 9 vpn virtual address (1-kbyte page) virtual address (4-kbyte page) tlb entry offset vpn vpn (31?7) vpn (11?0) asid sh sz v pr ppn c d offset 0 10 31 11 0 (15) (2) (2) (22) (8) (1) (1) (1) (1) (1) 12 vpn: virtual page number. top 22 bits of virtual address for a 1-kbyte page, or top 20 bits of virtual address for a 4-kbyte page. since vpn bits 16-12 are used as the index number, they are not stored in the tlb entry. asid: address space identifier. indicates the process that can access a virtual page. in single virtual memory mode and user mode, or in multiple virtual memory mode, if the sh bit is 0, the address is compared with the asid in pteh when address comparison is performed. sh: share status bit 0 = page not shared between processes 1 = page shared between processes sz: page size bit 0 = 1-kbyte page 1 = 4-kbyte page v: valid bit. indicates whether entry is valid. 0 = invalid 1 = valid cleared to 0 by a power-on reset. not affected by a manual reset. ppn: physical page number. top 22 bits of physical address. ppn bits 11-10 are not used in the case of a 4-kbyte page. attention must be paid to the synonym problem in the case of a 1-kbyte page (see section 3.4.4). set the most significant bit to 0. pr: protection key field. 2-bit field encoded to define the access rights to the page. 00: reading only is possible in privileged mode. 01: reading/writing is possible in privileged mode. 10: reading only is possible in privileged/user mode. 11: reading/writing is possible in privileged/user mode. c: cacheable bit. indicates whether the page is cacheable. 0: non-cacheable 1: cacheable d: dirty bit. indicates whether the page has been written to. 0 = not written to 1 = written to figure 3.5 virtual address and tlb structure
61 3.3.2 tlb indexing the tlb uses a 4-way set associative scheme, so entries must be selected by index. vpn bits 16 to 12 are used as the index number regardless of the page size. the index number can be generated in two different ways depending on the setting of the ix bit in mmucr. 1. when ix = 0, vpn bits 16?2 alone are used as the index number 2. when ix = 1, vpn bits 16?2 are ex-ored with asid bits 4? to generate a 5-bit index number the second method is used to prevent lowered tlb efficiency that results when multiple processes run simultaneously in the same virtual address space and a specific entry is selected by indexing of each process. figures 3.6 and 3.7 show the indexing schemes. 31 16 11 12 17 0 31 0 pteh register virtual address vpn 0 asid 7 10 index asid(4?) exclusive-or way 0? vpn(31?7) vpn(11?0) asid(7?) v 0 31 address array data array ppn(31?0) pr(1?) sz c d sh figure 3.6 tlb indexing (ix = 1)
62 31 16 11 12 17 0 virtual address way 0? vpn(31?7) vpn(11?0) asid(7?) v 0 address array data array ppn(31?0) pr(1?) sz c d sh index 31 figure 3.7 tlb indexing (ix = 0) 3.3.3 tlb address comparison the results of address comparison determine whether a specific virtual page number is registered in the tlb. the virtual page number of the virtual address that accesses external memory is compared to the virtual page number of the indexed tlb entry. the asid within the pteh is compared to the asid of the indexed tlb entry. all four ways are searched simultaneously. if the compared values match, and the indexed tlb entry is valid (v bit = 1), the hit is registered. it is necessary to have the software ensure that tlb hits do not occur simultaneously in more than one way, as hardware operation is not guaranteed if this happens. for example, if there are two identical tlb entries with the same vpn and a setting is made such that a tlb hit is made only by a process with asid = h'ff when one is in the shared state (sh = 1) and the other in the non- shared state (sh = 0), then if the asid in phe is set to h'ff, there is a possibility of simultaneous tlb hits in both these ways. it is therefore necessary to ensure that this kind of setting is not made by the software. the object compared varies depending on the page management information (sz, sh) in the tlb entry. it also varies depending on whether the system supports multiple virtual memory or single virtual memory. the page size information determines whether vpn (11?0) is compared. vpn (11?0) is compared for 1 kbyte pages (sz = 0) but not for 4 kbyte pages (sz = 1).
63 the sharing information (sh) determines whether the pteh.asid and the asid in the tlb entry are compared. asids are compared when there is no sharing between processes (sh = 0) but not when there is sharing (sh = 1). when single virtual memory is supported (mmucr.sv = 1) and privileged mode is engaged (sr.md = 1), all process resources can be accessed. this means that asids are not compared when single virtual memory is supported and privileged mode is engaged. the objects of address comparison are shown in figure 3.8. bits compared: vpn (31?7) vpn (11?0) sz = 0? yes no yes (1 kbyte) no (4 kbytes) bits compared: vpn (31?7) bits compared: vpn (31?7) vpn (11?0) asid (7?) sz = 0? yes (1 kbyte) no (4 kbytes) bits compared: vpn (31?7) asid (7?) sh = 1 or (sr.md = 1 and mmucr.sv = 1)? figure 3.8 objects of address comparison
64 3.3.4 page management information in addition to the sh and sz bits, the page management information of tlb entries also includes d, c, and pr bits. the d bit of a tlb entry indicates whether the page is dirty (i.e., has been written to). if the d bit is 0, an attempt to write to the page results in an initial page write exception. for physical page swapping between secondary memory and main memory, for example, pages are controlled so that a dirty page is paged out of main memory only after that page is written back to secondary memory. to record that there has been a write to a given page in the address translation table in memory, an initial page write exception is used. the c bit in the entry indicates whether the referenced page resides in a cacheable or non-cacheable area of memory. the pr field specifies the access rights for the page in privileged and user modes and is used to protect memory. attempts at nonpermitted accesses result in tlb protection violation exceptions. access states designated by the d, c, and pr bits are shown in table 3.2. table 3.2 access states designated by d, c, and pr bits privileged mode user mode reading writing reading writing d bit 0 permitted initial page write exception permitted initial page write exception 1 permitted permitted permitted permitted c bit 0 permitted (no caching) permitted (no caching) permitted (no caching) permitted (no caching) 1 permitted (with caching) permitted (with caching) permitted (with caching) permitted (with caching) pr bit 00 permitted tlb protection violation exception tlb protection violation exception tlb protection violation exception 01 permitted permitted tlb protection violation exception tlb protection violation exception 10 permitted tlb protection violation exception permitted tlb protection violation exception 11 permitted permitted permitted permitted
65 3 . 4 mmu functions 3.4.1 mmu hardware management mmu hardware management is of the following two kinds. 1. the mmu decodes the virtual address accessed by a process and performs address translation by controlling the tlb in accordance with the mmucr settings. 2. in address translation, the mmu receives page management information from the tlb, and determines the mmu exception and whether the cache is to be accessed (using the c bit). for details of the determination method and the hardware processing, see section 3.5, mmu exceptions. 3.4.2 mmu software management there are three kinds of mmu software management, as follows. 1. mmu register setting. mmucr setting, in particular, should be performed in areas p1 and p2 for which address translation is not performed. also, since sv and ix bit changes constitute address translation system changes, in this case, tlb flushing should be performed by simultaneously writing 1 to the tf bit also. since mmu exceptions are not generated in the mmu disabled state with the at bit cleared to 0, use in the disabled state must be avoided with software that does not use the mmu. 2. tlb entry recording, deletion, and reading. tlb entry recording can be done in two ways?y using the ldtlb instruction, or by writing directly to the memory-mapped tlb. for tlb entry deletion and reading, the memory allocation tlb can be accessed. see section 3.4.3, mmu instruction (ldtlb), for details of the ldtlb instruction, and section 3.6, memory- mapped tlb configuration, for details of the memory-mapped tlb. 3. mmu exception handling. when an mmu exception is generated, it is handled on the basis of information set from the hardware side. see section 3.5, mmu exceptions, for details. when single virtual memory mode is used, it is possible to create a state in which physical memory access is enabled in privileged mode only by clearing the share status bit (sh) to 0 to specify recording of all tlb entries. this strengthens inter-process memory protection, and enables special access levels to be created in privileged mode only. recording a 1-kbyte page tlb entry may result in a synonym problem. see section 3.4.4, avoiding synonym problems.
66 3.4.3 mmu instruction (ldltb) the load tlb instruction (ldtlb) is used to record tlb entries. when the ix bit in mmucr is 0, the ldtlb instruction changes the tlb entry in the way specified by the rc bit in mmucr to the value specified by pteh and ptel, using vpn bits 16?2 specified in pteh as the index number. when the ix bit in mmucr is 1, the ex-or of vpn bits 16?2 specified in pteh and asid bits 4? in pteh are used as the index number. figure 3.9 shows the case where the ix bit in mmucr is 0. when an mmu exception occurs, the virtual page number of the virtual address that caused the exception is set in pteh by hardware. the way is set in the rc bit of mmucr for each exception according to the rules shown in figure 3.9. consequently, if the ldtlb instruction is issued after setting only ptel in the mmu exception handling routine, tlb entry recording is possible. any tlb entry can be updated by software rewriting of pteh and the rc bits in mmucr. as the ldtlb instruction changes address translation information, there is a risk of destroying address translation information if this instruction is issued in the p0, u0, or p3 area. make sure, therefore, that this instruction is issued in the p1 or p2 area. also, an instruction associated with an access to the p0, u0, or p3 area (such as the rte instruction) should be issued at least two instructions after the ldltb instruction.
67 vpn(31?7) vpn(11?0) asid(7?) v vpn 0 asid vpn 0 sv 0 0 rc 0 tf ix at ppn 0 v 0 pr sz c d sh 0 write ppn(31?0) pr(1?) sz c d sh write data array address array way selection way 0 to 3 31 9 0 mmucr index 31 17 12 10 8 0 pteh register 31 10 0 ptel register 0 31 figure 3.9 operation of ldtlb instruction 3.4.4 avoiding synonym problems when a 1-kbyte page is recorded in a tlb entry, a synonym problem may arise. if a number of virtual addresses are mapped onto a single physical address, the same physical address data will be recorded in a number of cache entries, and it will not be possible to guarantee data congruity. the reason why this problem only occurs when using a 1-kbyte page is explained below with reference to figure 3.10. to achieve high-speed operation of the sh7708 series cache, an index number is created using virtual address bits 10?. when a 4-kbyte page is used, virtual address bits 10? are included in the offset, and since they are not subject to address translation, they are the same as physical address bits 10?. in cache-based address comparison and recording in the address array, since the cache tag address is a physical address, physical address bits 31?0 are recorded. when a 1-kbyte page is used, also, a cache index number is created using virtual address bits 10-4. however, in the case of a 1-kbyte page, virtual address bit 10 is subject to address translation and therefore may not be the same as physical address bit 10. consequently, the physical address is recorded in a different entry from that of the index number indicated by the physical address in the cache address array.
68 for example, assume that, with 1-kbyte page tlb entries, tlb entries for which the following translation has been performed are recorded in two tlbs: virtual address 1 h'00000000 ? physical address h'00000400 virtual address 2 h'00000400 ? physical address h'00000400 virtual address 1 is recorded in cache entry h'00, and virtual address 2 in cache entry h'40. since the two virtual addresses are recorded in different cache entries despite the fact that the physical addresses are the same, memory inconsistency will occur as soon as a write is performed to either virtual address. therefore, when recording a 1-kbyte tlb entry, if the physical address is the same as a physical address already used in another tlb entry, it should be recorded in such a way that physical address bit 10 is the same.
69 when using a 4-kbyte page virtual address 31 vpn 0 12 11 10 offset physical address 31 ppn 0 offset virtual address (10?) physical address (31?0) cache address array when using a 1-kbyte page virtual address 31 vpn 0 10 offset physical address 31 ppn 0 10 offset virtual address (10?) physical address (31?0) cache address array 9 9 12 11 10 figure 3.10 synonym problem
70 3 . 5 mmu exceptions there are four mmu exceptions: tlb miss, tlb protection violation, tlb invalid, and initial page write. 3.5.1 tlb miss exception a tlb miss results when the virtual address and the address array of the selected tlb entry are compared and no match is found. tlb miss exception handling includes both hardware and software operations. hardware operations: in a tlb miss, the sh7708 series hardware executes a set of prescribed operations, as follows: 1. the vpn field of the virtual address causing the exception is written to the pteh register. 2. the virtual address causing the exception is written to the tea register. 3. either exception code h'040 for a load access, or h'060 for a store access, is written to the expevt register. 4. the pc value indicating the address of the instruction in which the exception occurred is written to the save program counter (spc). if the exception occurred in a delay slot, the pc value indicating the address of the related delayed branch instruction is written to the spc. 5. the contents of the status register (sr) at the time of the exception are written to the save status register (ssr). 6. the mode (md) bit in sr is set to 1 to place the sh7708 series in privileged mode. 7. the block (bl) bit in sr is set to 1 to mask any further exception requests. 8. the register bank (rb) bit in sr is set to 1. 9. the rc field in the mmu control register (mmucr) is incremented by 1 when all entries indexed are valid. when some entries indexed are invalid, the smallest way number of them is set in rc. 10. execution branches to the address obtained by adding the value of the vbr contents and h'00000400 to invoke the user-written tlb miss exception handler. software (tlb miss handler) operations: the software searches the page tables in external memory and allocates the required page table entry. upon retrieving the required page table entry, the software must execute the following operations: 1. write the value of the physical page number (ppn) field and the protection key (pr), page size (sz), cacheable (c), dirty (d), share status (sh), and valid (v) bits of the page table entry recorded in the address translation table in external memory into the ptel register in the sh7708 series.
71 2. if using software for way selection for entry replacement, write the desired value to the rc field in mmucr. 3. issue the ldtlb instruction to load the contents of pteh and ptel into the tlb. 4. issue the return from exception handler (rte) instruction to terminate the handler routine and return to the instruction stream. the rte instruction should be issued at least two instructions after the ldtlb instruction. 3.5.2 tlb protection violation exception a tlb protection violation exception results when the virtual address and the address array of the selected tlb entry are compared and a valid entry is found to match, but the type of access is not permitted by the access rights specified in the pr field. tlb protection violation exception handling includes both hardware and software operations. hardware operations: in a tlb protection violation exception, the sh7708 series hardware executes a set of prescribed operations, as follows: 1. the vpn field of the virtual address causing the exception is written to the pteh register. 2. the virtual address causing the exception is written to the tea register. 3. either exception code h'0a0 for a load access, or h'0c0 for a store access, is written to the expevt register. 4. the pc value indicating the address of the instruction in which the exception occurred is written into spc (if the exception occurred in a delay slot, the pc value indicating the address of the related delayed branch instruction is written into spc). 5. the contents of sr at the time of the exception are written to ssr. 6. the md bit in sr is set to 1 to place the sh7708 series in privileged mode. 7. the bl bit in sr is set to 1 to mask any further exception requests. 8. the register bank (rb) bit in sr is set to 1. 9. the way that generated the exception is set in the rc field in mmucr. 10. execution branches to the address obtained by adding the value of the vbr contents and h'00000100 to invoke the tlb protection violation exception handler. software (tlb protection violation handler) operations: the software resolves the tlb protection violation and issues the rte (return from exception handler) instruction to terminate the handler and return to the instruction stream. the rte instruction should be issued at least two instructions after the ldtlb instruction.
72 3.5.3 tlb invalid exception a tlb invalid exception results when the virtual address is compared to a selected tlb entry address array and a match is found but the entry is not valid (the v bit is 0). tlb invalid exception handling includes both hardware and software operations. hardware operations: in a tlb invalid exception, the sh7708 series hardware executes a set of prescribed operations, as follows: 1. the vpn number of the virtual address causing the exception is written to the pteh register. 2. the virtual address causing the exception is written to the tea register. 3. the way number causing the exception is written to rc in mmucr. 4. either exception code h'040 for a load access, or h'060 for a store access, is written to the expevt register. 5. the pc value indicating the address of the instruction in which the exception occurred is written to the spc. if the exception occurred in a delay slot, the pc value indicating the address of the delayed branch instruction is written to the spc. 6. the contents of sr at the time of the exception are written into ssr. 7. the mode (md) bit in sr is set to 1 to place the sh7708 series in privileged mode. 8. the block (bl) bit in sr is set to 1 to mask any further exception requests. 9. the register bank (rb) bit in sr is set to 1. 10. execution branches to the address obtained by adding the value of the vbr contents and h'00000100, and the tlb protection violation exception handler starts. software (tlb invalid exception handler) operations: the software searches the page tables in external memory and assigns the required page table entry. upon retrieving the required page table entry, the software must execute the following operations: 1. write the values of the physical page number (ppn) field and the values of the protection key (pr), page size (sz), cacheable (c), dirty (d), share status (sh), and valid (v) bits of the page table entry recorded in external memory to the ptel register. 2. if using software for way selection for entry replacement, write the desired value to the rc field in mmucr. 3. issue the ldtlb instruction to load the contents of pteh and ptel into the tlb. 4. issue the rte instruction to terminate the handler and return to the instruction stream. the rte instruction should be issued after two ldtlb instructions.
73 3.5.4 initial page write exception an initial page write exception results in a write access when the virtual address and the address array of the selected tlb entry are compared and a valid entry with the appropriate access rights is found to match, but the d (dirty) bit of the entry is 0 (the page has not been written to). initial page write exception handling includes both hardware and software operations. hardware operations: in an initial page write exception, the sh7708 series hardware executes a set of prescribed operations, as follows: 1. the vpn field of the virtual address causing the exception is written to the pteh register. 2. the virtual address causing the exception is written to the tea register. 3. exception code h'080 is written to the expevt register. 4. the pc value indicating the address of the instruction in which the exception occurred is written to the spc. if the exception occurred in a delay slot, the pc value indicating the address of the related delayed branch instruction is written to the spc. 5. the contents of sr at the time of the exception are written to ssr. 6. the md bit in sr is set to 1 to place the sh7708 series in privileged mode. 7. the bl bit in sr is set to 1 to mask any further exception requests. 8. the register bank (rb) bit in sr is set to 1. 9. the way that caused the exception is set in the rc field in mmucr. 10. execution branches to the address obtained by adding the value of the vbr contents and h'00000100 to invoke the user-written initial page write exception handler. software (initial page write handler) operations: the software must execute the following operations: 1. retrieve the required page table entry from external memory. 2. set the d bit of the page table entry in external memory to 1. 3. write the value of the ppn field and the pr, sz, c, d, sh, and v bits of the page table entry in external memory to the ptel register. 4. if using software for way selection for entry replacement, write the desired value to the rc field in mmucr. 5. issue the ldtlb instruction to load the contents of pteh and ptel into the tlb. 6. issue the rte instruction to terminate the handler and return to the instruction stream. the rte instruction should be issued after two ldtlb instructions. figure 3.11 shows the flowchart for mmu exceptions.
74 start tlb miss exception initial page write exception pr check pr check yes sh = 0 and (mmucr.sv = 0 or sr.md = 0)? vpns and asids match? vpns match? no yes yes yes yes user or privileged? d = 1? c = 1? v = 1? no no user mode privileged mode no no tlb protection violation exception tlb protection violation cache access w 00/01 10 01/11 00/10 11 ww w rr rr r/w? r/w? r/w? r/w? tlb invalid exception memory access no (noncacheable) yes (cacheable) figure 3.11 mmu exception generation flowchart
75 3.5.5 processing flow in event of mmu exception (same processing flow for address error) figure 3.12 shows the mmu exception signals in instruction fetch mode. id ex ma wb id ex ma wb id ex ma wb nop nop if id ex ma wb : exception source stage if id ex ma wb nop mmu exception handler handler transition processing = instruction fetch = instruction decode = instruction execution = memory access = write back = no operation if figure 3.12 mmu exception signals in instruction fetch
76 figure 3.13 shows the mmu exception signals in data access mode. if id ex if id ex if id id ex ma wb id ex ma wb id ex ma wb nop nop if id ex ma wb : exception source stage : stage cancellation for instruction that has begun execution if id ex ma wb nop = instruction fetch = instruction decode = instruction execution = memory access = write back = no operation mmu exception handler handler transition processing ma wb ma wb ex ma wb figure 3.13 mmu exception signals in data access
77 3 . 6 memory-mapped tlb in order for tlb operations to be managed by software, tlb contents can be read or written to in privileged mode using the mov instruction. the tlb is assigned to the p4 area in virtual address space. the tlb address array (vpn, v bit, and asid) is assigned to h'f2000000?'f2ffffff, and the data array (ppn, pr, sz, c, d, and sh bits) to h'f3000000?'f3ffffff. the v bit in the address array can also be accessed from the data array. only longword access is possible for both the address array and the data array. 3.6.1 address array the address array is assigned to h'f2000000 to h'f2ffffff. to access an address array, the 32-bit address field (for read/write operations) and 32-bit data field (for write operations) must be specified. the address field specifies information for selecting the entry to be accessed; the data field specifies the vpn, v bit and asid to be written to the address array (figure 3.14 (1)). in the address field, specify the entry address for selecting the entry (bits 16?2), w for selecting the way (bits 9?: 00 is way 0, 01 is way 1, 10 is way 2, 11 is way 3) and h'f2 to indicate address array access (bits 31?4). the ix bit in mmucr indicates whether an ex-or is taken of the entry address and asid. when writing, specify bit 7 as the a bit. the a bit indicates whether addresses are compared during writing. when the a bit is 1, the vpns of the four entries selected by the entry addresses are compared to the vpn to be written into the address array specified in the data field. writing takes place to the way that has a hit. when a miss occurs, nothing is written to the address array and no operation occurs. the way number specified in bits 9? is not used. the item compared is determined by the sz and sh bits of the entry selected by the entry address, the sv bit in mmucr and the md bit in sr, just as in ordinary operations (see section 3.3.3). when the a bit is 0, it is written to the entry selected with the entry address and way number without comparing addresses. when reading, the vpn (31?7, 11?0), v bit, and asid of the entry specified by the entry address and way number are read in the format of the data field in figure 3.14 without comparing addresses. zero is read in the data field (16?2). to invalidate a specific entry, specify the entry and write 0 to its v bit. when 1 is specified for the a bit, only the required vpn entry is invalidated.
78 3.6.2 data array the data array is assigned to h'f3000000 to h'f3ffffff. to access a data array, the 32-bit address field (for read/write operations), and 32-bit data field (for write operations) must be specified. these are specified in the general register. the address section specifies information for selecting the entry to be accessed; the data section specifies the longword data to be written to the data array (figure 3.14 (2)). in the address section, specify the entry address for selecting the entry (bits 16?2), w for selecting the way (bits 9?: 00 is way 0, 01 is way 1, 10 is way 2, 11 is way 3), and h'f3 to indicate data array access (bits 31?4). the ix bit in mmucr indicates whether an ex-or is taken of the entry address and asid. both reading and writing use the longword of the data array specified by the entry address and way number. the access size of the data array is fixed at longword.
79 vpn 31 23 11110010 * * 16 (1) tlb address array access read access w 0 * vpn * 31 23 24 24 17 17 17 11110010 * ** * 16 write access read/write access w 60 * * a vpn 31 23 24 11110011 * * 16 17 address field w 0 * * 31 data field 10 ppn 8 9 7654 3 2 1 0 x v xx vpn 31 16 data field (2) tlb data array access 12 10 11 8 97 12 10 11 8 97 12 10 11 8 97 12 10 11 8 97 6 * 0 0 asid 0v vpn 0 0 17 vpn 16 12 10 11 vpn 31 asid 8 97 0 * v d c sh pr sz vpn: v: a: w: virtual page number valid bit association bit way (00: way 0, 01: way 1, 10: way 2, 11: way 3) asid: : address space identifier don? care bit ppn: pr: c: sh: vpn: x: w: physical page number protection key field cacheable bit share status bit virtual page number 0 for read, don? care bit for write way (00: way 0, 01: way 1, 10: way 2, 11: way 3) v: sz: d: : valid bit page size bit dirty bit don? care bit address field data field address field * * * * * * * figure 3.14 specifying address and data for memory-mapped tlb access
80 3.6.3 usage examples invalidating specific entries: specific tlb entries can be invalidated by writing 0 to the entry? v bit. when the a bit is 1, the vpn and asid specified by the write data is compared to the vpn and asid within the tlb entry selected by the entry address and data is written to the matching way. if no match is found, there is no operation. r0 specifies the write data and r1 specifies the address. ; r0=h'1547 381c r1=h'f201 3080 ; mmucr.ix=0 ; vpn(31?7)=b'0001 0101 0100 011 vpn(11?0)=b'10 asid=b'0001 1100 ; corresponding entry association is made from the entry selected by ; the vpn(16?2)=b'1 0011 index, the v bit of the hit way is cleared to ; 0,achieving invalidation. mov.l r0,@r1 reading the data of a specific entry: this example reads the data section of a specific tlb entry. the bit order indicated in the data field in figure 3.14 (2) is read. r0 specifies the address and the data section of a selected entry is read to r1. ; r0=h'f300 4300 vpn(16-12)=b'00100 way 3 ; mov.l @r0,r1 3 . 7 usage note instructions that manipulate the md or bl bit in register sr (the ldc rm, sr instruction, ldc @rm+, sr instruction, and rte instruction) and the following instruction, or the ldtlb instruction, should be used with the tlb disabled or in a fixed physical address space (the p1 or p2 space).
81 section 4 exception handling 4 . 1 overview 4.1.1 features exceptions are deviations from normal program execution that require special handling. the processor responds to an exception by aborting execution of the current instruction (execution is allowed to continue to completion in all interrupt requests) and passing control from the instruction stream to the appropriate user-written exception handling routine. here, all exceptions other than resets and interrupts will be called general exceptions. there are thus three types of exceptions: resets, general exceptions, and interrupts. 4.1.2 register configuration a register with an undefined initial value should be initialized by software. table 4.1 lists the registers used for exception handling. table 4.1 register configuration register abbr. r/w size initial value address trapa exception register tra r/w longword undefined h'ffffffd0 exception event register expevt r/w longword power-on reset: h'000 manual reset: h'020 h'ffffffd4 interrupt event register intevt r/w longword undefined h'ffffffd8 4 . 2 exception handling function 4.2.1 exception handling flow usually the contents of the program counter (pc) and status register (sr) are saved in the saved program counter (spc) and saved status register (ssr), respectively, and execution of the exception handler is invoked from a vector address. the return from exception handler (rte) instruction is issued by the exception handler routine at the completion of the routine, restoring the contents of the pc and sr to return to the processor status at the point of interruption and the address where the exception occurred.
82 a basic exception processing sequence consists of the following operations: the contents of the pc and sr are saved in the spc and ssr, respectively. the block (bl) bit in sr is set to 1, masking any subsequent exceptions. the mode (md) bit in sr is set to 1 to place the sh7708 series in privileged mode. the register bank (rb) bit in sr is set to 1. an encoded value identifying the exception event is written to bits 11? of the exception event (expevt) or interrupt event (intevt) register. instruction execution jumps to the designated exception processing vector address to invoke the handler routine. 4.2.2 exception handling vector addresses the reset vector address is fixed at h'a0000000. the other three events are assigned offsets from the vector base address by software. translation lookaside buffer (tlb) miss exceptions have an offset from the vector base address of h'00000400. the vector address offset for general exception events other than tlb miss exceptions is h'00000100. the interrupt vector address offset is h'00000600. the vector base address is loaded into the vector base register (vbr) by software. the vector base address should reside in p1 or p2 fixed physical address space. figure 4.1 shows the relationship between the vector base address, the vector offset, and the vector table. vbr + vector offset h'a000 0000 vector table figure 4.1 vector table in table 4.2, exceptions and their vector addresses are listed by exception type, instruction completion status, relative acceptance priority, relative order of occurrence within an instruction execution sequence and vector address for exceptions and their vector addresses.
83 table 4.2 vectored exception events exception type current instructio n exception event priority* 1 exceptio n order vector address vector offset reset aborted power-on 1 h'a00000000 manual reset 1 h'a00000000 general exception aborted and retried address error (instruction access) 2 1 h'00000100 events tlb miss (instruction access) 2 2 h'00000400 tlb invalid (instruction access) 2 3 h'00000100 tlb protection violation (instruction access) 2 4 h'00000100 reserved instruction code exception 2 5 h'00000100 illegal slot instruction exception 2 5 h'00000100 address error (data access) 2 6 h'00000100 tlb miss (data access) 2 7 h'00000400 tlb invalid (data access) 2 8 h'00000100 tlb protection violation (data access) 2 9 h'00000100 initial page write 2 10 h'00000100 completed unconditional trap (trapa instruction) 2 5 h'00000100 user breakpoint trap 2 n* 2 h'00000100
84 table 4.2 vectored exception events (cont) exception type current instructio n exception event priority* 1 exceptio n order vector address vector offset general interrupt completed nonmaskable interrupt 3 h'00000600 requests external hardware interrupt 4* 3 h'00000600 peripheral module interrupt 4* 3 h'00000600 notes: 1. priorities are indicated from high to low, 1 being highest and 4 being lowest. 2. the user defines the break point traps. 1 is a break point before instruction execution and 11 is a break point after instruction execution. for an operand break point, use 11. 3. use software to specify relative priorities of external hardware interrupts and peripheral module interrupts (see section 6, interrupt controller (intc)). 4.2.3 acceptance of exceptions processor resets and interrupts are asynchronous events unrelated to the instruction stream. all exception events are prioritized to establish an acceptance order whenever two or more exception events occur simultaneously. the power-on reset and manual reset may not occur simultaneously, so they have the same priority. all general exception events occur in a relative order in the execution sequence of an instruction (i.e., execution order), but are handled at priority level 2 in instruction-stream order (i.e., program order), where an exception detected in a preceding instruction is accepted prior to an exception detected in a subsequent instruction. three general exception events (reserved instruction code exception, unconditional trap, and illegal slot instruction exception) are detected in the decode stage of different instructions and are mutually exclusive events in the instruction pipeline. they have the same execution priority. figure 4.2 shows the order of general exception acceptance.
85 if instruction n id ex ma tlb miss (data access) wb if instruction n + 1 instruction n + 2 id ex ma tlb miss (instruction access) wb if id ex ma rie (reserved instruction exception) wb pipeline sequence: tlb miss (instruction n) re-execution of instruction n 1 2 3 tlb miss (instruction n + 1) re-execution of instruction n + 1 rie (instruction n + 2) if id ex ma wb = instruction fetch = instruction decode = instruction execution = memory access = write back handling order: program order: tlb miss (instruction n+1) tlb miss (instruction n) and rie (instruction n + 2) = simultaneous detection detection order: figure 4.2 example of acceptance order of general exceptions all exceptions other than a reset are detected in the pipeline id stage, and accepted on instruction boundaries. however, an exception is not accepted between a delayed branch instruction and the delay slot. a re-execution type exception detected in a delay slot is accepted before execution of the delayed branch instruction. a completion type exception detected in a delayed branch instruction or delay slot is accepted after execution of the delayed branch instruction. the delay slot here refers to
86 the next instruction after a delayed unconditional branch instruction, or the next instruction when a delayed conditional branch instruction is true. 4.2.4 exception codes table 4.3 lists the exception codes written to bits 11? of the expevt register (for reset or general exceptions) or the intevt register (for general interrupt requests) to identify each specific exception event. an additional exception register, the trapa (tra) register, is used to hold the 8-bit immediate data in an unconditional trap (trapa instruction). table 4.3 exception codes exception type exception event exception code reset power-on h'000 manual reset h'020 general exception events tlb miss/invalid (load) h'040 tlb miss/invalid (store) h'060 initial page write h'080 tlb protection violation (load) h'0a0 tlb protection violation (store) h'0c0 address error (load) h'0e0 address error (store) h'100 unconditional trap (trapa instruction) h'160 reserved instruction code exception h'180 illegal slot instruction exception h'1a0 user break point trap h'1e0 general interrupt requests nonmaskable interrupt h'1c0 external hardware interrupts: irl3?rl0 = 0000 h'200 irl3?rl0 = 0001 h'220 irl3?rl0 = 0010 h'240 irl3?rl0 = 0011 h'260 irl3?rl0 = 0100 h'280 irl3?rl0 = 0101 h'2a0 irl3?rl0 = 0110 h'2c0 irl3?rl0 = 0111 h'2e0 irl3?rl0 = 1000 h'300
87 table 4.3 exception codes (cont) exception type exception event exception code general interrupt requests external hardware interrupts (cont): (cont) irl3?rl0 = 1001 h'320 irl3?rl0 = 1010 h'340 irl3?rl0 = 1011 h'360 irl3?rl0 = 1100 h'380 irl3?rl0 = 1101 h'3a0 irl3?rl0 = 1110 h'3c0 peripheral module interrupt: tmu0 tuni0 h'400 tmu1 tuni1 h'420 tmu2 tuni2 h'440 ticpi2 h'460 rtc ati h'480 pri h'4a0 cui h'4c0 sci eri h'4e0 rxi h'500 txi h'520 tei h'540 wdt iti h'560 ref rcmi h'580 rovi h'5a0 note: exception codes h'120, h'140, and h'3e0 are reserved. 4.2.5 exception request masks when the bl bit in sr is cleared to 0, exceptions and interrupts are accepted. if a general exception event occurs when the bl bit in sr is 1, the cpu? internal registers are set to their post-reset state, other module registers retain their contents prior to the general exception, and a branch is made to the same address (h'a0000000) as for a reset.
88 if a general interrupt occurs when bl = 1, the request is masked (held pending) and not accepted until the bl bit is cleared to 0 by software. for reentrant exception handling, the spc and ssr must be saved and the bl bit in sr cleared to 0. 4.2.6 returning from exception handling the rte instruction is used to return from exception handling. when rte is executed, the spc value is set in the pc, and the ssr value in sr, and the return from exception handling is performed by branching to the spc address. if the spc and ssr have been saved in external memory, set the bl bit in sr to 1, then restore the spc and ssr, and issue an rte instruction. 4 . 3 register description there are three registers related to exception handling. these are peripheral module registers, and therefore reside in area p4. they can be accessed by specifying the address in privileged mode only. 1. the exception event register (expevt) resides at address h'ffffffd4, and contains a 12-bit exception code. the exception code set in expevt is that for a reset or general exception event. the exception code is set automatically by hardware when an exception occurs. expevt can also be modified by software. 2. the interrupt event register (intevt) resides at address h'ffffffd8, and contains a 12-bit exception code. the exception code set in expevt is that for an interrupt request. the exception code is set automatically by hardware when an exception occurs. intevt can also be modified by software. 3. the trapa exception register (tra) resides at address h'ffffffd0, and contains 8-bit immediate data (imm) for the trapa instruction. tra is set automatically by hardware when a trapa instruction is executed. tra can also be modified by software. the bit configurations of the expevt, intevt, and tra registers are shown in figure 4.3. 31 0 0 exception code imm 00 11 0 expevt register and intevt register 8-bit immediate data in trapa instruction imm: 0: reserved bits, always read as zero 31 00 920 tra register figure 4.3 bit configurations of expevt, intevt, and tra registers
89 4 . 4 exception handler operation 4.4.1 reset the reset sequence is used to power up or restart the sh7708 series from the initialization state. the reset signal is sampled every clock cycle, and in the case of a power-on reset, all processing being executed (excluding the rtc) is suspended, all unfinished events are canceled, and reset processing is executed immediately. in the case of a manual reset, however, processing to retain external memory contents is continued. the breq (bus request) signal is used to distinguish between a power-on reset (high-level input) and manual reset (low-level input). the reset sequence consists of the following operations: the md bit in sr is set to 1 to place the sh7708 series in privileged mode. the bl bit in sr is set to 1, masking any subsequent exceptions. the rb bit in sr is set to 1. an encoded value of h'000 in a power-on reset or h'020 in a manual reset is written to bits 11? of the expevt register to identify the exception event. instruction execution jumps to the user-written exception handler at address h'a0000000. 4.4.2 interrupts an interrupt processing request is accepted on completion of the current instruction. the interrupt acceptance sequence consists of the following operations: the contents of the pc and sr are saved in spc and ssr, respectively. the bl bit in sr is set to 1, masking any subsequent exceptions. the md bit in sr is set to 1 to place the sh7708 series in privileged mode. the rb bit in sr is set to 1. an encoded value identifying the exception event is written to bits 11? of the intevt register. instruction execution jumps to the vector location designated by the sum of the value of the contents of the vector base register (vbr) and h'00000600 to invoke the exception handler. 4.4.3 general exceptions when the sh7708 series encounters any exception condition other than a reset or interrupt request, it executes the following operations: the contents of the pc and sr are saved in the spc and ssr, respectively. the bl bit in sr is set to 1, masking any subsequent exceptions. the md bit in sr is set to 1 to place the sh7708 series in privileged mode.
90 the rb bit in sr is set to 1. an encoded value identifying the exception event is written to bits 11? of the expevt register. instruction execution jumps to the vector location designated by either the sum of the vector base address and offset h'00000400 in the vector table in a tlb miss trap, or by the sum of the vector base address and offset h'00000100 for exceptions other than tlb miss traps, to invoke the exception handler. 4 . 5 individual exception operations this section describes the conditions for specific exception handling, and the processor operations. 4.5.1 resets power-on reset ? conditions: breq pin high and reset low ? operations: expevt set to h'000, vbr and sr initialized, branch to pc = h'a0000000. initialization sets the vbr register to h'0000000. in sr, the md, rb and bl bits are set to 1 and the imask field is set to b'1111. the cpu and on-chip supporting modules are initialized. see the register descriptions in the relevant sections for details. a power-on reset must always be performed when powering on. manual reset ? conditions: breq pin low and reset low ? operations: expevt set to h'020, vbr and sr initialized, branch to pc = h'a0000000. initialization sets the vbr register to h'0000000. in sr, the md, rb, and bl bits are set to 1 and the imask field is set to b'1111. the cpu and on-chip supporting modules are initialized. see the register descriptions in the relevant sections for details. table 4.4 types of reset conditions for transition to reset state internal state type breq reset cpu on-chip supporting modules power-on reset high low initialized (see register configuration in relevant sections) manual reset low low initialized
91 4.5.2 general exceptions tlb miss exception ? conditions: comparison of tlb addresses shows no address match ? operations: the virtual address (32 bits) that caused the exception is set in tea and the corresponding virtual page number (22 bits) is set in pteh (31?0). the asid of pteh indicates the asid at the time the exception occurred. the rc bit in mmucr is incremented by one for replacement. the pc and sr of the instruction that generated the exception are saved to the spc and ssr, respectively. if the exception occurred during a read, h'040 is set in expevt; if the exception occurred during a write, h'060 is set in expevt. the bl, md and rb bits in sr are set to 1 and a branch occurs to pc = vbr + h'0400. to speed up tlb miss processing, the offset differs from other exceptions. tlb invalid exception ? conditions: comparison of tlb addresses shows address match but v = 0 ? operations: the virtual address (32 bits) that caused the exception is set in tea and the corresponding virtual page number (22 bits) is set in pteh (31?0). the asid of pteh indicates the asid at the time the exception occurred. the way that generated the exception is set in the rc bits in mmucr. the pc and sr of the instruction that generated the exception are saved in the spc and ssr, respectively. if the exception occurred during a read, h'040 is set in expevt; if the exception occurred during a write, h'060 is set in expevt. the bl, md, and rb bits in sr are set to 1 and a branch occurs to pc = vbr + h'0100. initial page write exception ? conditions: a hit occurred to the tlb for a store access, but d = 0 this occurs for initial writes to the page registered by the load. ? operations: the virtual address (32 bits) that caused the exception is set in tea and the corresponding virtual page number (22 bits) is set in pteh (31?0). the asid of pteh indicates the asid at the time the exception occurred. the way that generated the exception is set in mmucr.rc. the pc and sr of the instruction that generated the exception are saved to the spc and ssr, respectively. h'080 is set in expevt. the bl, md, and rb bits in sr are set to 1 and a branch occurs in pc = vbr + h'0100.
92 tlb protection exception ? conditions: when a hit access violates the tlb protection information (pr bits) shown below: pr privileged mode user mode 00 only read enabled no access 01 read/write enabled no access 10 only read enabled only read enabled 11 read/write enabled read/write enabled ? operations: the virtual address (32 bits) that caused the exception is set in tea and the corresponding virtual page number (22 bits) is set in pteh (31?0). the asid of pteh indicates the asid at the time the exception occurred. the way that generated the exception is set in the rc bits in mmucr. the pc and sr of the instruction that generated the exception are saved to the spc and ssr, respectively. if the exception occurred during a read, h'0a0 is set in expevt; if the exception occurred during a write, h'0c0 is set in expevt. the bl, md, and rb bits in sr are set to 1 and a branch occurs to pc = vbr + h'0100. address error ? conditions: a. instruction fetch from odd address (4n + 1, 4n + 3) b. word data accessed from addresses other than word boundaries (4n + 1, 4n + 3) c. longword accessed from addresses other than longword boundaries (4n + 1, 4n + 2, 4n + 3) d. virtual space accessed in user mode in the area h'80000000 to h'ffffffff. ? operations: the virtual address (32 bits) that caused the exception is set in tea. the pc and sr of the instruction that generated the exception are saved to the spc and ssr, respectively. if the exception occurred during a read, h'0e0 is set in expevt; if the exception occurred during a write, h'100 is set in expevt. the bl, md, and rb bits in sr are set to 1 and a branch occurs to pc = vbr + h'0100. for details see section 3.5.5, processing flow in event of mmu exception. unconditional trap ? conditions: trapa instruction executed ? operations: the exception is a processing-completion type, so the pc of the instruction after the trapa instruction is saved to the spc. sr from the time when the trapa instruction was executing is saved to ssr. the 8-bit immediate value in the trapa instruction is quadrupled and set in tra(9?). h'160 is set in expevt. the bl, md, and rb bits in sr are set to 1 and a branch occurs to pc = vbr + h'0100.
93 reserved instruction exception ? conditions: a. when undefined code not in a delay slot is decoded delay branch instructions: jmp, jsr, bra, braf, bsr, bsrf, rts, rte, bt/s, bf/s undefined instructions: h'fxxx(sh7708, sh7708s), h'fxxf(sh7708r) b. when a privileged instruction not in a delay slot is decoded in user mode privileged instructions: ldc, stc, rte, ldtlb, sleep; instructions that access gbr with ldc/stc are not privileged instructions ? operations: the pc and sr of the instruction that generated the exception are saved to the spc and ssr, respectively. h'180 is set in expevt. the bl, md, and rb bits in sr are set to 1 and a branch occurs to pc = vbr + h'0100. when an undefined instruction other than h'fxxx is decoded, operation cannot be guaranteed. illegal slot instruction ? conditions: a. when undefined code in a delay slot is decoded delay branch instructions: jmp, jsr, bra, braf, bsr, bsrf, rts, rte, bt/s, bf/s undefined instructions: h'fxxx(sh7708, sh7708s), h'fxxf(sh7708r) b. when an instruction that rewrites the pc in a delay slot is decoded instructions that rewrite the pc: jmp, jsr, bra, braf, bsr, bsrf, rts, rte, bt, bf, bt/s, bf/s, trapa, ldc rm, sr, ldc.l, @rm+, sr c. when a privileged instruction in a delay slot is decoded in user mode privileged instructions: ldc, stc, rte, ldtlb, sleep; instructions that access gbr with ldc/stc are not privileged instructions ? operations: the pc of the previous delay branch instruction is saved to the spc. sr of the instruction that generated the exception is saved to ssr. h'1a0 is set in expevt. the bl, md, and rb bits in sr are set to 1 and a branch occurs to pc = vbr + h'0100. when an undefined instruction other than h'fxxx is decoded, operation cannot be guaranteed. user break point trap ? conditions: when a break condition set in the user break point controller is satisfied ? operations: when a post-execution break occurs, the pc of the instruction immediately after the instruction that set the break point is set in the spc. if a pre-execution break occurs, the pc of the instruction that set the break point is set in the spc. sr when the break occurs is set in ssr. h'1e0 is set in expevt. the bl, md, and rb bits in sr are set to 1 and a branch occurs to pc = vbr + h'0100. see section 7, user break controller, for more information.
94 4.5.3 interrupts nmi ? conditions: nmi pin edge detection ? operations: the pc and sr after the instruction that receives the interrupt are saved to the spc and ssr, respectively. h'01c0 is set in intevt. the bl, md, and rb bits in sr are set to 1 and a branch occurs to pc = vbr + h'0600. this interrupt is not masked by sr.imask and is accepted with top priority when the bl bit in sr is 0. when the bl bit is 1, the interrupt is masked. see section 6, interrupt controller, for more information. irl interrupts ? conditions: the value of the interrupt mask bits in sr is lower than the irl3?rl0 level and the bl bit in sr is 0. the interrupt is accepted at an instruction boundary. ? operations: the pc after the instruction that accepts the interrupt is saved to the spc. sr at the time the interrupt is accepted is saved to ssr. the code corresponding to the irl3?rl0 level is set in intevt. the corresponding code is given as h'200 + b'(irl3?rl0) h'20. the bl, md, and rb bits in sr are set to 1 and a branch occurs to vbr + h'0600. the received level is not set in sr.imask. see section 6, interrupt controller, for more information. on-chip module interrupts ? conditions: the value of the interrupt mask bits in sr is lower than the on-chip module (tmu, rtc, sci, cpg, ref) interrupt level and the bl bit in sr is 0. the interrupt is accepted at an instruction boundary. ? operations: the pc after the instruction that accepts the interrupt is saved to the spc. sr at the time the interrupt is accepted is saved to ssr. the code corresponding to the interrupt source is set in intevt. see table 6.4, interrupt exception vectors and rankings, for the corresponding codes. the bl, md, and rb bits in sr are set to 1 and a branch occurs to vbr + h'0600. b'0000 to b'1111 are set in the interrupt priority level registers (irpa, irpb) within the interrupt controller. see section 6, interrupt controller, for more information.
95 4 . 6 cautions return from exception handling ? check the bl bit in sr with software. when the spc and ssr have been saved to external memory, set the bl bit in sr to 1 before restoring them. ? issue an rte instruction. set the spc in the pc and ssr in sr with the rte instruction, branch to the spc address, and return from exception handling. operation when exception or interrupt occurs while sr.bl = 1 ? interrupt: acceptance is suppressed until the bl bit in sr is set to 0 by software. if there is a request and the reception conditions are satisfied, the interrupt is accepted after the execution of the instruction that sets the bl bit in sr to 0. during the sleep or standby mode, however, the interrupt will be accepted even when the bl bit in sr is 1. ? exception: no user break point trap will occur even when the break conditions are met. when one of the other exceptions occurs, a branch is made to the fixed address of the reset (h'a0000000). in this case, the values of the expevt, spc, and ssr registers are undefined. spc when an exception occurs: the pc saved to the spc when an exception occurs is as shown below: ? re-executing-type exceptions: the pc of the instruction that caused the exception is set in the spc and re-executed after return from exception handling. if the exception occurred in a delay slot, however, the pc of the immediately prior delayed branch instruction is set in the spc. if the condition of the conditional delayed branch instruction is not satisfied, the delay slot pc is set in spc. ? completed-type exceptions and interrupts: the pc of the instruction after the one that caused the exception is set in the spc. if the exception was caused by a delayed conditional instruction, however, the branch destination pc is set in spc. if the condition of the conditional delayed branch instruction is not satisfied, the delay slot pc is set in spc. initial register values after reset ? undefined registers r0_bank0/1?7_bank0/1, r8?15, gbr, spc, ssr, mach, macl, pr ? initialized registers vbr = h'00000000 sr.md = 1, sr.bl = 1, sr.rb = 1, sr.i3?r.i0 = h'f. other sr bits are undefined. pc = h'a0000000 ensure that an exception is not generated at an rte instruction delay slot, as operation is not guaranteed in this case. when the bl bit in sr is 1, ensure that a tlb-related exception or address error is not caused by an ldc instruction that updates sr and the following instruction, as these may be identified as multiple exceptions and may start reset processing.
96
97 section 5 cache 5 . 1 overview 5.1.1 features the cache specifications are listed in table 5.1. table 5.1 cache specifications parameter specification capacity selectable: normal mode: 8 kbytes ram mode: 4 kbytes cache and 4 kbytes ram structure instruction/data mixed, 4-way set associative (2-way set associative in ram mode) line size 16 bytes number of entries 128 entries/way write system p0, p1, p3, u0: write-back/write-through selectable replacement method least-recently-used (lru) algorithm 5.1.2 cache structure the cache mixes data and instructions and uses a 4-way set associative system. it is composed of four ways (banks), each of which is divided into an address section and a data section. each of the address and data sections is divided into 128 entries. the data section of the entry is called a line. each line consists of 16 bytes (4 bytes 4). the data capacity per way is 2 kbytes (16 bytes 128 entries), with a total of 8 kbytes in the cache as a whole (4 ways). figure 5.1 shows the cache structure.
98 entry 0 address array (ways 0?) v u address 24 (1 + 1 + 22) bits entry 1 ? ? ? entry 127 0 data array (ways 0?) lru section lw0 lw1 lw2 lw3 128 (32 4) bits lw0elw3: longword data 0e3 1 127 0 1 127 6 bits figure 5.1 cache structure address array: the v bit indicates whether the entry data is valid. when the v bit is 1, data is valid; when 0, data is not valid. the u bit indicates whether the entry has been written to in write- back mode. when the u bit is 1, the entry has been written to; when 0, it has not. the address tag holds the physical address used in the external memory access. it is composed of 22 bits (address bits 31?0) used for comparison during cache searches. in the sh7708 series, the top three of the 32 physical address bits are used as shadow bits (see section 10), and therefore in a normal replace operation the top three bits of the vector address are cleared to 0. the v and u bits are initialized to 0 by a power-on reset, but are not initialized by a manual reset. the tag address is not initialized by either a power-on or manual reset. data array: holds a 16-byte instruction or data. entries are registered in the cache in line units (16 bytes). the data array is not initialized by a power-on or manual reset. lru: with the 4-way set associative system, up to four instructions or data with the same entry address (address bits 10?) can be registered in the cache. when an entry is registered, the lru shows which of the four ways it is recorded in. there are six lru bits, controlled by hardware. a least-recently-used (lru) algorithm is used to select the way. in normal mode, four ways are used as cache and six lru bits indicate the way to be replaced (table 5.2). if a bit pattern other than those listed in table 5.2 is set in the lru bits by software, the cache will not function correctly. when modifying the lru bits by software, set one of the patterns listed in table 5.2.
99 in ram mode, two ways are used as cache (way 0 and way 1). bit 5 of the lru bits indicates which way is to be replaced. when bit 5 is 0, way 1 is to be replaced. when bit 5 is 1, way 0 is to be replaced. the lru bits are initialized to 0 by a power-on reset, but are not initialized by a manual reset. table 5.2 lru and way replacement in normal mode lru (5?) way to be replaced 000000, 000100, 010100, 100000, 110000, 110100 3 000001, 000011, 001011, 100001, 101001, 101011 2 000110, 000111, 001111, 010110, 011110, 011111 1 111000, 111001, 111011, 111100, 111110, 111111 0 5.1.3 register configuration table 5.3 shows details of the cache control register. table 5.3 register configuration register abbr. r/w size initial value* address cache control register ccr r/w longword h'00000000 h'ffffffec note: initialized by a power-on reset or manual reset. 5 . 2 register description 5.2.1 cache control register (ccr) the cache is enabled or disabled using the ce bit of the cache control register (ccr). ccr also has an ra bit (which switches the cache operation mode between ram mode and normal mode), a cf bit (which invalidates all cache entries), a wt bit and a cb bit* (which selects either write- through mode or write-back mode). programs that change the contents of the ccr register should be placed in address space that is not cached. when updating the contents of the ccr register, always set bit 4 to 0. figure 5.2 shows the configuration of the ccr register. cb bit is not supported in emulator. note:sh7708s,sh7708r only
100 0cf wtce 4 ra ... ... ... ... ... ... ... ... ... 5 6 31 ram bit. indicates the cache operation mode. 1 = 4 kbytes cache/4 kbytes cache (ram mode) 0 = 8 kbytes cache (normal mode) always set to 0 when setting the register. cache flush bit. invalidates all cache entries. 1 = flush (clears the v, u, and lru bits of all entries to 0). always reads 0. write-back to external memory is not performed when the cache is flushed. reserved bits. always read 0; and the write value should always be 0. write-through bit. indicates the cache? operating mode for areas p0, u0, and p3. 1 = write-through mode, 0 = write-back mode. cache enable bit. indicates whether the cache function is used. 1 = cache used, 0 = cache not used. p1 area write-back/write-through switching bit 1 = write-back mode, 0 = write-through mode ra: 0: cf: ? wt: ce: cb: 3210 * note:sh7708:reserved bit sh7708s,sh7708r:cb figure 5.2 ccr register configuration 5 . 3 cache operation 5.3.1 searching the cache if the cache is enabled, whenever instructions or data in memory are accessed the cache will be searched to see if the desired instruction or data is in the cache. figure 5.3 illustrates the method by which the cache is searched. the cache is a physical cache and holds physical addresses in its address section. entries are selected using bits 10? of the address (virtual) of the access to memory and the address tag of that entry is read. in parallel to reading of the address tag, the virtual address is translated to a physical address in the mmu. the physical address after translation and the physical address read from the address section are compared. the address comparison uses all four ways in normal mode. in ram mode, two ways (way 0 and way 1) are used in the address comparison. when the comparison shows a match and the selected entry is valid (v = 1), a cache hit occurs. when the comparison does not show a match or the selected entry is not valid (v = 0), a cache miss occurs. figure 5.3 shows a hit on way 1.
101 cmp1 0 ways 0? longword (lw) selection entry selection 10 11 3 1 40 2 31 virtual address v u address mmu 1 127 cmp0 hit signal 1 cmp2 cmp3 physical address ways 0? lw0 lw1 lw2 lw3 cmp0: cmp1: cmp2: cmp3: comparison circuit 0 comparison circuit 1 comparison circuit 2 comparison circuit 3 figure 5.3 cache search scheme (normal mode)
102 5.3.2 read access read hit: in a read access, instructions and data are transferred from the cache to the cpu. the transfer unit is 32 bits. the lru is updated. read miss: an external bus cycle starts and the entry is updated. the way replaced is the one least recently used. entries are updated in 16-byte units. when the desired instruction or data that caused the miss is loaded from external memory to the cache, the instruction or data is transferred to the cpu in parallel with being loaded to the cache. when it is loaded in the cache, the u bit is cleared to 0 and the v bit is set to 1. when the u bit of a replaced entry in write-back mode is 1, the cache fill cycle starts after the entry is transferred to the write-back buffer. after the cache completes its fill cycle, the write-back buffer writes back the entry to memory. the write-back unit is 16 bytes. 5.3.3 write access write hit: in a write access in write-back mode, data is written to the cache and the u bit of the entry written is set to 1. writing occurs only to the cache; no external memory write cycle is issued. in write-through mode, data is written to the cache and an external memory write cycle is issued. write miss: in write-back mode, an external bus cycle starts when a write miss occurs and an entry with its u bit set to 1 is replaced. the way to be replaced is the one least recently used. when the u bit of the entry to be replaced is 1, the cache fill cycle starts after the entry is transferred to the write-back buffer. after the cache completes its fill cycle, the write-back buffer writes back the entry to memory. the write-back unit is 16 bytes. data is written to the cache and the u bit is set to 1. in write-through mode, no write to cache occurs in a write miss; the write is only to external memory. 5.3.4 write-back buffer when the u bit of the entry to be replaced in write-back mode is 1, it must be written back to external memory. to increase performance, the entry to be replaced is first transferred to the write- back buffer and fetching of new entries to the cache takes priority over writing back to external memory. during the write back cycles, the cache can be accessed. the write-back buffer can hold one line of cache data (16 bytes) and its physical address. figure 5.4 shows the configuration of the write-back buffer.
103 longword 0 longword 1 longword 2 longword 3 pa (31?) pa (31?): longword 0?: physical address written to external memory the line of cache data to be written to external memory figure 5.4 write-back buffer configuration 5.3.5 coherency of cache and external memory use software to ensure coherency between the cache and the external memory. when memory shared by the sh7708 series and another device is accessed, the latest data may be in a write-back mode cache, so invalidate the entry that includes the latest data in the cache, generate a write back, and update the data in memory before using it. when the caching area is updated by a device other than the sh7708 series, invalidate the entry that includes the updated data in the cache. 5.3.6 ram mode in ram mode, way 0 and way 1 function as a 4-kbyte two-way set associative cache, while way 2 and way 3 function as 4-kbyte internal ram. the internal ram is mapped onto h'7f000000 to h'7f000fff with 4-kbyte shadow areas from h'7f001000 to h'7fffffff. in ram mode with the mmu enabled, a virtual address from h'7f00000 to h'7fffffff is not translated to an external physical address. the internal ram can be accessed in both privileged and user mode by setting its address as source or destination address in the instructions. before changing the ra bit in the ccr register to change the cache operation mode, all entries in the cache should be invalidated. 5 . 4 memory-mapped cache to allow software management of the cache, it is mapped onto virtual address space p4. the address array is mapped onto addresses h'f0000000 to h'f0ffffff and the data array onto addresses h'f1000000 to h'f1ffffff. in privileged mode, the cache contents can be read or written using the mov instruction. with the address array and data array, the access size is fixed at longword, and instruction fetches cannot be performed. 5.4.1 address array the address array is mapped onto h'f0000000 to h'f0ffffff. to access an address array, the 32- bit address field (for read/write accesses) and 32-bit data field (for write accesses) must be specified. the address field specifies information for selecting the entry to be accessed; the data field specifies the address, v bit, u bit, and lru bits to be written to the address array (figure 5.5(1)).
104 in the address field, specify the entry address for selecting the entry (bits 10?), w for selecting the way (bits 12?1: 00 is way 0, 01 is way 1, 10 is way 2, 11 is way 3 in normal mode (8-kbyte cache); 00 and 10 are way 0, and 01 and 11 are way 1 in ram mode), and h'f0 to indicate address array access (bits 31?4). when writing, specify bit 3 as the a bit. the a bit indicates whether addresses are compared during writing. when the a bit is 1, the addresses of the four entries selected by the entry addresses are compared to the addresses to be written into the address array specified in the data field. writing takes place to the way that has a hit. when a miss occurs, nothing is written to the address array and no operation occurs. the way number (w) specified in bits 12?1 is not used. when the a bit is 0, it is written to the entry selected with the entry address and way number without comparing addresses. the address specified by bits 31?0 in the data specification in figure 5.5 (1), address array access, is a virtual address. when the mmu is enabled, the address is translated into a physical address, then the physical address is used in comparing addresses when the a bit is 1. the physical address is written into the address array. when reading, the address tag, v bit, u bit, and lru bits of the entry specified by the entry address and way number (w) are read using the data format shown in figure 5.5 without comparing addresses. to invalidate a specific entry, specify the entry by its entry address and way number, and write 0 to its v bit. to invalidate only an entry for an address to be invalidated, specify 1 for the a bit. when an entry for which 0 is written to the v bit has a u bit set to 1, if it is a valid entry it will be written back. this allows coherency to be achieved between the external memory and cache by invalidating the entry. however, when 0 is written to the v bit, 0 must also be written to the u bit of that entry. in the sh7708 series, the top 3 bits of the 32-bit physical address are treated as a shadow (see section 10, bus state controller (bsc)). therefore, in the event of a cache miss, 0 is registered in the top 3 bits of the address array address tag. when directly changing the address array using the mov instruction, also, a value other than 0 must not be set in the top 3 bits of the address tag. 5.4.2 data array the data array is mapped onto h'f1000000 to h'f1ffffff. to access a data array, the 32-bit address field (for read/write accesses) and 32-bit data field (for write accesses) must be specified. the address field specifies information for selecting the entry to be accessed; the data field specifies the longword data to be written to the data array (figure 5.5 (2)). in the address field, specify the entry address for selecting the entry (bits 10?), l for indicating the longword position within the (16 byte) line (bits 3?: 00 is longword 0, 01 is longword 1, 10 is longword 2, 11 is longword 3), w for selecting the way (bits 12?1: 00 is way 0, 01 is way 1, 10
105 is way 2, 11 is way 3 in normal mode; 00 and 10 are way 0, and 01 and 11 are way 1 in ram mode), and h'f1 to indicate data array access (bits 31?4). both reading and writing use the longword of the data array specified by the entry address, way number and longword address. the access size of the data array is fixed at longword. w * * 0 *** 4 entry 11110000 31 read access 23 24 3 2 0 12 13 10 11 w * * a * ** 4 entry 11110000 31 write access address specification 23 24 3 2 0 12 13 10 11 w * * l * * 4 entry 11110001 31 23 24 3 2 1 0 12 13 10 11 xx u v 4 lru address tag (31?0) 31 data specification (both read and write accesses) 321 0 10 9 (2) data array access (both read and write accesses) address specification (1) address array access longword 31 0 data specification x: : 0 for read, don? care bit for write don? care bit * figure 5.5 specifying address and data for memory-mapped cache access
106 5 . 5 usage examples 5.5.1 invalidating specific entries specific cache entries can be invalidated by writing 0 to the entry? v bit. when the a bit is 1, the address tag specified by the write data is compared to the address tag within the cache selected by the entry address, and data is written when a match is found. if no match is found, there is no operation. r0 specifies the write data in r0 and r1 specifies the address. when the v bit of an entry in the address array is set to 0, the entry is written back if the entry? u bit is 1. ; r0=h'01100010; vpn=b'0000 0001 0001 0000 0000 00, u=0, v=0 ; r1=h'f0000088; address array access, entry=b'0001000, a=1 ; mov.l r0,@r1 5.5.2 reading the data of a specific entry this example reads the data section of a specific cache entry. the longword indicated in the data field of the data array in figure 5.5 is read to the register. r0 specifies the address and r1 is read. ; r1=h'f100 004c; data array access, entry=b'0000100, way = 0, longword ; address = 3 ; mov.l @r0,r1 ; longword 3 is read.
107 section 6 interrupt controller (intc) 6 . 1 overview the interrupt controller (intc) ascertains the priority of interrupt sources and controls interrupt requests to the cpu. the intc registers set the order of priority of each interrupt, allowing the user to handle interrupt requests according to the user-set priority. 6.1.1 features intc has the following features: 15 levels of interrupt priority can be set: by setting the two interrupt-priority registers, the priorities of on chip supporting module interrupts can be selected from 15 levels for different request sources. nmi noise canceller function: nmi input level bit indicates nmi pin status. by reading this bit in the interrupt exception handler, the pin status can be checked, enabling it to be used as a noise canceler. external devices can be notified that an interrupt has been received ( irqout pin): for example, when the sh7708 series has released the bus, the external bus master can be notified of the fact that an external interrupt, an on-chip supporting module interrupt, or a memory refresh request has occurred, enabling the sh7708 series to request the bus.
108 6.1.2 block diagram figure 6.1 shows a block diagram of the intc. ref wdt sci rtc tmu icr input control com- parator priority identifier 3 44 interrupt request sr ipra?prb irl3 C irl0 nmi irqout timer unit realtime clock unit serial communication interface watch dog timer memory refresh controller section of the bus state controller interrupt control register interrupt priority level setting registers aCb status register tmu: rtc: sci: wdt: ref: icr: ipraCiprb: sr: (interrupt request) (interrupt request) (interrupt request) (interrupt request) (interrupt request/ refresh request) ipr cpu internal bus bus interface intc 2 1 0 figure 6.1 intc block diagram
109 6.1.3 pin configuration table 6.1 shows the intc pin configuration. table 6.1 pin configuration name abbreviation i / o description nonmaskable interrupt input pin nmi i input of nonmaskable interrupt request signal interrupt input pins irl3 irl0 i input of interrupt request signals (maskable by i3?0 in sr) bus request output pin irqout o output of signal that notifies external devices that an interrupt or memory refresh request has occurred 6.1.4 register configuration the intc has the three registers listed in table 6.2. table 6.2 register configuration name abbr. r/w initial value* 1 address access size interrupt control register icr r/w * 2 h'fffffee0 16 interrupt priority level setting register a ipra r/w h'0000 h'fffffee2 16 interrupt priority level setting register b iprb r/w h'0000 h'fffffee4 16 notes: 1. initialized by a power-on reset or manual reset. 2. h'8000 when the nmi pin is high, h'0000 when the nmi pin is low. 6 . 2 interrupt sources there are three types of interrupt sources: nmi, irl, and on-chip supporting modules. each interrupt has a priority level (0?6) with 0 the lowest and 16 the highest. priority level 0 masks an interrupt.
110 6.2.1 nmi interrupts the nmi interrupt has the highest priority level of 16. it is always accepted unless the bl bit in the status register in the cpu is set to 1, and is edge-detected. in sleep or standby mode, the interrupt is accepted regardless of the bl setting. the nmi edge select bit (nmie) in the interrupt control register (icr) is used to select either the rising or falling edge. when the nmie bit in the icr register is changed, the nmi interrupt is not detected for 20 cycles after changing icr. nmi interrupt exception handling does not affect the interrupt mask level bits (i3?0) in the status register (sr). 6.2.2 irl interrupts irl interrupts are input by level at pins irl3 irl0 . the priority level is the level indicated by pins irl3 irl0 . an irl3 irl0 value of 0 (0000) indicates the highest-level interrupt request (interrupt priority level 15). a value of 15 (1111) indicates no interrupt request (interrupt priority level 0). figure 6.2 shows an examples of an irl interrupt connection. table 6.3 shows irl pins and interrupt levels. interrupt request priority encoder irl3 to irl0 4 sh7708series irl3 to irl0 figure 6.2 example of irl interrupt connection
111 table 6.3 irl3 irl0 pins and interrupt levels irl3 irl2 irl1 irl0 interrupt priority levelinterrupt request 0000 15 level 15 interrupt request 0001 14 level 14 interrupt request 0010 13 level 13 interrupt request 0011 12 level 12 interrupt request 0100 11 level 11 interrupt request 0101 10 level 10 interrupt request 0110 9 level 9 interrupt request 0111 8 level 8 interrupt request 1000 7 level 7 interrupt request 1001 6 level 6 interrupt request 1010 5 level 5 interrupt request 1011 4 level 4 interrupt request 1100 3 level 3 interrupt request 1101 2 level 2 interrupt request 1110 1 level 1 interrupt request 1111 0 no interrupt request a noise-cancellation feature is built in, and the irl interrupt is not detected unless the levels sampled at every supporting module cycle remain unchanged for two consecutive cycles, so that no transient level on the irl pin change is detected. in standby mode, as the peripheral clock is stopped, noise cancellation is performed using the 32.768 khz clock for the rtc instead. therefore when the rtc is not used, interruption by means of irl interrupts cannot be performed in standby mode. the priority level of the irl interrupt must not be lowered unless the interrupt is accepted and the interrupt handling starts. however, the priority level can be changed to a higher one. the interrupt mask bits (i3?0) in the status register (sr) are not affected by irl interrupt handling.
112 6.2.3 on-chip supporting module interrupts on-chip supporting module interrupts are generated by the following five modules: timer unit (tmu) realtime clock (rtc) serial communication interface (sci) bus state controller (bsc) watchdog timer (wdt) not every interrupt source is assigned a different interrupt vector. sources are reflected on the interrupt event register (intevt). it is easy to identify sources by using the values of the intevt register as branch offsets (in the exception handler routine). the priority level (from 0?5) can be set for each module by writing to interrupt priority setting registers a? (ipra?prb). the interrupt mask bits (i3?0) in the status register are not affected by the on-chip supporting module interrupt handling. on-chip supporting module interrupt source flag and interrupt enable flag updating should only be performed when the bl bit in the status register (sr) is set to 1. to prevent acknowledgment of an erroneous interrupt from an interrupt source that should have been updated, first read the on-chip peripheral register containing the relevant flag, then clear the bl bit to 0. this will secure the necessary timing internally. when updating a number of flags, there is no problem if only the register containing the last flag updated is read. if flag updating is performed while the bl bit is cleared to 0, the program may jump to the interrupt service routine when the intevt register value is 0. in this case, interrupt handling is initiated due to the timing relationship between the flag update and interrupt request recognition within the chip. processing can be continued without any problem by executing an rte instruction. 6.2.4 interrupt exception handling and priority table 6.3 lists the codes for the interrupt event register (intevt), and the order of interrupt priority. each interrupt source is assigned unique code. the start address of the interrupt handler is common to each interrupt source. this is why, for instance, the value of intevt is used as offset at the start of the interrupt handler and branched to identify the interrupt source. the order of priority of the on-chip supporting module is set within the priority levels 0?5 at will by using the interrupt priority level set in registers a and b (ipra?prb). the order of priority of the on-chip supporting module is set to zero by a reset.
113 when the priorities for multiple interrupt sources are set to the same level and such interrupts are generated at the same time, they are handled according to the default order listed in table 6.4. updating of interrupt priority level setting registers a and b should only be performed when the bl bit in the status register (sr) is set to 1. to prevent erroneous interrupt acknowledgment, first read one or other of the interrupt priority level setting registers, then clear the bl bit to 0. this will secure the necessary timing internally. table 6.4 interrupt exception vectors and rankings interrupt source intevt code interrupt priority (initial value) ipr (bit numbers) priority within ipr setting unit default priorit y nmi h'1c0 16 high irl irl3 irl0 = 0000 h'200 15 irl3 irl0 = 0001 h'220 14 irl3 irl0 = 0010 h'240 13 irl3 irl0 = 0011 h'260 12 irl3 irl0 = 0100 h'280 11 irl3 irl0 = 0101 h'2a0 10 irl3 irl0 = 0110 h'2c0 9 irl3 irl0 = 0111 h'2e0 8 irl3 irl0 = 1000 h'300 7 irl3 irl0 = 1001 h'320 6 irl3 irl0 = 1010 h'340 5 irl3 irl0 = 1011 h'360 4 irl3 irl0 = 1100 h'380 3 irl3 irl0 = 1101 h'3a0 2 irl3 irl0 = 1110 h'3c0 1 tmu0 tuni0* 1 h'400 0?5 (0) ipra (15?2) tmu1 tuni1* 1 h'420 0?5 (0) ipra (11?) tmu2 tuni2* 1 h'440 0?5 (0) ipra (7?) high tmu2 ticpi2* 2 h'460 0?5 (0) ipra (7?) low low
114 table 6.4 interrupt exception vectors and rankings (cont) interrupt source intevt code interrupt priority (initial value) ipr (bit numbers) priority within ipr setting unit default priority rtc ati* 3 h'480 0?5 (0) ipra (3?) high high rtc pri* 4 h'4a0 0?5 (0) ipra (3?) rtc cui* 5 h'4c0 0?5 (0) ipra (3?) low sci eri* 6 h'4e0 0?5 (0) iprb (7?) high sci rxi* 7 h'500 0?5 (0) iprb (7?) sci txi* 8 h'520 0?5 (0) iprb (7?) sci tei* 9 h'540 0?5 (0) iprb (7?) low wdt iti h'560 0?5 (0) iprb (15?2) ref rcmi* 10 h'580 0?5 (0) iprb (11?) high ref rovi* 11 h'5a0 0?5 (0) iprb (11?) low low notes: 1. tuni0?uni2: underflow interrupts, see section 11. 2. ticpi2: input capture interrupt, see section 11. 3. ati: alarm interrupt, see section 12. 4. pri: periodic interrupt, see section 12. 5. cui: carry-up interrupt, see section 12. 6. eri: receive error interrupt, see section 13. 7. rxi: receive-data-full interrupt, see section 13. 8. txi: transmit-data-empty interrupt, see section 13. 9. tei: transmit-data-end interrupt, see section 13. 10. iti: interval timer interrupt, see section 9. 11. rcmi: compare-match interrupt, see section 10. 12. rovi: refresh counter overflow interrupt, see section 10.
115 6 . 3 intc registers 6.3.1 interrupt priority registers a and b (ipra?prb) interrupt priority registers a and b (ipra and iprb) are 16-bit read/write registers that set priority levels from 0 to 15 for on-chip supporting module interrupts. these registers are initialized to h'0000 by a reset. they are not initialized in standby mode. bit: 15 14 13 12 11 10 9 8 bit name: initial value: 0 0 0 0 0 0 0 0 r/w: r/w r/w r/w r/w r/w r/w r/w r/w bit: 7 6 5 4 3 2 1 0 bit name: initial value: 0 0 0 0 0 0 0 0 r/w: r/w r/w r/w r/w r/w r/w r/w r/w table 6.5 lists the relationship between the interrupt sources and the ipra and iprb bits. table 6.5 interrupt request sources and ipra?prb register bits 15 to 12 bits 11 to 8 bits 7 to 4 bits 3 to 0 ipra tmu0 tmu1 tmu2 rtc iprb wdt ref* 1 sci reserved * 2 notes: 1. ref is the memory refresh unit in the bus state controller. see section 10, bus state controller, for details. 2. reserved bits: always read 0. only 0 should be written. as listed in table 6.5, four sets of on-chip supporting modules are assigned to each register. 4-bit groups (bits 15 to 12, bits 11 to 8, bits 7 to 4, and bits 3 to 0) are set with values from h'0 (0000) to h'f (1111). setting h'0 means priority level 0 (masking is requested); h'f is priority level 15 (the highest level).
116 6.3.2 interrupt control register (icr) icr is a 16-bit register that sets the input signal detection mode of the external interrupt input pin nmi and indicates the input signal level to the nmi pin. this register is initialized by a power-on reset or manual reset. it is not initialized in standby mode. bit: 15 14 13 12 11 10 9 8 bit name: nmil nmie initial value: 0/1* 0 0 0 0 0 0 0 r/w: r r r r r r r r/w bit: 7 6 5 4 3 2 1 0 bit name: initial value: 0 0 0 0 0 0 0 0 r/w: r r r r r r r r note: when nmi input is high: 1; when nmi input is low: 0. bit 15?mi input level (nmil): sets the level of the signal input at the nmi pin. this bit can be read to determine the nmi pin level. it cannot be modified. bit 15: nmil description 0 nmi input level is low 1 nmi input level is high bit 8?mi edge select (nmie): selects whether the falling or rising edge of the interrupt request signal to the nmi is detected. bit 8: nmie description 0 interrupt request is detected on the falling edge of nmi input (initial value) 1 interrupt request is detected on rising edge of nmi input bits 14? and 7??eserved: these bits always read 0. the write value should always be 0.
117 6 . 4 intc operation 6.4.1 interrupt sequence the sequence of interrupt operations is explained below. figure 6.3 is a flowchart of the operations. 1. the interrupt request sources send interrupt request signals to the interrupt controller. 2. the interrupt controller selects the highest priority interrupt from the interrupt requests sent, following the priority levels set in interrupt priority registers a and b (ipra and iprb). lower priority interrupts are held pending. if two of these interrupts have the same priority level or if multiple interrupts occur within a single module, the interrupt with the highest default priority or the highest priority within its ipr setting unit (as indicated in table 6.4) is selected. 3. the priority level of the interrupt selected by the interrupt controller is compared with the interrupt mask bits (i3?0) in the status register (sr) of the cpu. if the request priority level is higher than the level in bits i3?0, the interrupt controller accepts the interrupt and sends an interrupt request signal to the cpu. when the interrupt controller receives an interrupt, a low level is output from the irqout pin. 4. the cpu receives an interrupt at a break in instructions. 5. the interrupt source code is set in the interrupt event register (intevt). 6. the status register (sr) and program counter (pc) are saved to ssr and spc, respectively. 7. the block bit (bl), mode bit (md), and register bank bit (rb) in sr are set to 1. 8. the cpu jumps to the start address of the interrupt handler (the sum of the value set in the vector base register (vbr) and h'00000600). the interrupt handler may branch with the intevt register value as its offset in order to identify the interrupt source. this enables it to branch to the handling routine for the individual interrupt source. notes: 1. the interrupt mask bits (i3?0) in the status register (sr) are not changed by acceptance of an interrupt in the sh7708 series. 2. irqout outputs a low level until the interrupt request is cleared. however, if the interrupt source is masked by an interrupt mask bit, the irqout pin returns to the high level. the level is output without regard to the bl bit. 3. the interrupt source flag should be cleared in the interrupt handler. to ensure that an interrupt request that should have been cleared is not inadvertently accepted again, read the interrupt source flag after it has been cleared, then wait for the interval shown in table 6.6 (time for priority decision and sr mask bit comparison) before clearing the bl bit or executing an rte instruction.
118 program execution state no yes no yes no yes no no yes yes no yes no no yes no yes irqout = low save sr to ssr; save pc to spc set interrupt cause in intevt set bl/md/rb bits in sr to 1 branch to exception handler interrupt generated? (sr. bl = 0) or (sleep or standby mode)? nmi? level 14 interrupt? level 1 interrupt? i3Ci0 level 13 or lower? i3Ci0 level 0? yes level 15 interrupt? i3Ci0 level 14 or lower? i3Ci0: interrupt mask bits in status register (sr) figure 6.3 interrupt operation flowchart
119 6.4.2 multiple interrupts when handling multiple interrupts, an interrupt handler should include the following procedures: 1. branch to a specific interrupt handler corresponding to a code set in intevt. the code in intevt can be used as a branch-offset for branching to the specific handler. 2. clear the cause of the interrupt in each specific handler. 3. save ssr and spc to memory. 4. clear the bl bit in sr, and set the accepted interrupt level in the interrupt mask bits in sr. 5. handle the interrupt. 6. execute the rte instruction. when these procedures are followed in order, an interrupt of higher priority than the one being handled can be accepted after clearing bl in step 4. figure 6.3 shows a sample interrupt operation flowchart.
120 6 . 5 interrupt response time the time from generation of an interrupt request until interrupt exception handling is performed and fetching of the first instruction of the exception handler is started (the interrupt response time) is shown in table 6.6. figure 6.4 shows an example of pipeline operation when an irl interrupt is accepted. when sr.bl is 1, interrupt exception handling is masked, and is kept waiting until completion of an instruction that clears bl to 0. table 6.6 interrupt response time number of states item nmi irl supporting modules notes time for priority decision and sr mask bit comparison 0.5 icyc + 0.5 bcyc + 0.5 pcyc 0.5 icyc + 0.5 bcyc + 2 pcyc 0.5 icyc + 1.5 pcyc wait time until end of sequence being executed by cpu x ( 3 0) icyc x ( 3 0) icyc x ( 3 0) icyc interrupt exception handling is kept waiting until the executing instruction ends. if the number of instruction execution states is s* 1 , the maximum wait time is: x = s ?1. however, if bl is set to 1 by instruction execution or by an exception, interrupt exception handling is deferred until completion of an instruction that clears bl to 0. if the following instruction masks interrupt exception handling, the handling may be further deferred. time from interrupt exception handling (save of sr and pc) until fetch of first instruction of exception handler is started 5 icyc 5 icyc 5 icyc
121 table 6.6 interrupt response time (cont) number of states item nmi rl peripheral modules notes response time total (5.5 + x) icyc + 0.5 bcyc + 0.5 pcyc (5.5 + x) icyc + 0.5 bcyc + 2 pcyc (5.5 + x) icyc + 1.5 pcyc minimum case* 2 6.5 8 7 at 60 mhz operation: 0.10?.14 m s maximum case* 3 7 + s 13 + s 10.5 + s at 60 mhz operation: 0.23?.34 m s (in case of operand cache-hit) at 60 mhz operation: 0.27?.37 m s (when external memory access is performed with wait = 0) icyc: duration of one cycle of internal clock supplied to cpu, etc. bcyc: duration of one ckio cycle pcyc: duration of one cycle of peripheral clock supplied to supporting modules notes: 1. s also includes the memory access wait time. the processing requiring the maximum execution time is ldc.l @rm+, sr. when the memory access is a cache-hit, this requires 7 instruction execution cycles. when external access is performed, the corresponding number of cycles must be added. there are also instructions that perform two external memory accesses; if external memory access is slow, the number of instruction execution cycles will increase accordingly. 2. the internal clock : ckio : peripheral clock ratio is 1 : 1 : 1. 3. the internal clock : ckio : peripheral clock ratio is 1 : 1 : 1/4.
122 interrupt acceptance irl 0.5 icyc + 0.5 bcyc + 2 pcyc instruction (instruction replaced by interrupt exception handling) if id ex ex ex ex if if id ex 5 icyc start of interrupt handling if: instruction fetch ... instruction is fetched from memory in which program is stored. id: instruction decode ... fetched instruction is decoded. ex: instruction execution ... data operation and address calculation are performed in accordance with result of decoding. overrun fetch first instruction of interrupt handler figure 6.4 example of pipeline operations when irl interrupt is accepted
123 section 7 user break controller (ubc) 7 . 1 overview the user break controller (ubc) provides functions that simplify program debugging. these functions make it easy to design an effective self-monitoring debugger, enabling programs to be debugged in the chip alone, without using an in-circuit emulator. break conditions that can be set in the ubc are instruction fetch or data read/write, data size, data content, address value, and stop timing during instruction fetches. 7.1.1 features the features of the user break controller are listed below. two break channels (channel a and channel b). user break interrupts can be requested using either independent or sequential condition for the two channels (sequential breaks are channel a, then channel b). selection and setting of the following as break compare conditions: ? address selection of 32-bit logical address and asid to be compared address: compare all bits, mask bottom 10 bits, mask bottom 12 bits. mask all bits asid: compare all bits/mask all bits ? data (channel b only, 32-bit maskable) ? bus cycle: instruction fetch/data access ? read/write ? operand size: byte/word/longword the instruction fetch cycle break can be performed before or after the instruction is executed. user break trap generated when break conditions are satisfied. a user-designed user break trap routine can be run. 7.1.2 block diagram figure 7.1 shows the logical block diagram of the user break controller.
124 bbra address comparator access comparator address comparator data comparator access comparator access control address bus channel a channel b data bus control basra bamra bara bbrb basrb bamrb barb brcr user break trap request bbra: break bus cycle register a bara: break address register a basra: break asid register a bamra: break address mask register a bbrb: break bus cycle register b barb: break address register b basrb: break asid register b bamrb: break address mask register b bdrb: break data register b bdmrb: break data mask register b brcr: break control register bdrb bdmrb figure 7.1 logical block diagram of user break controller
125 7.1.3 register configuration table 7.1 shows the user break controller registers. table 7.1 ubc registers channel register initial value* 1 access size access address r/w a bara undefined longword h'ffffffb0 r/w basra undefined byte h'ffffffe4 r/w bamra undefined byte h'ffffffb4 r/w bbra h'0000* 2 word h'ffffffb8 r/w b barb undefined longword h'ffffffa0 r/w bamrb undefined byte h'ffffffa4 r/w basrb undefined byte h'ffffffe8 r/w bbrb h'0000* 2 word h'ffffffa8 r/w bdrb undefined longword h'ffffff90 r/w bdmrb undefined longword h'ffffff94 r/w common brcr h'0000* 2 word h'ffffff98 r/w notes: 1. value is retained in standby mode. 2. initialized by power-on reset or manual reset. 7.1.4 break conditions and register settings the relationship between break conditions and register settings is as follows: 1. break conditions for channel a or b are set in the respective registers. 2. the address is set in the bara or barb register. asid is set in the basra or basrb register. whether the address is included in the break conditions, or whether or not masking is to be performed, is set in the bama or bamb bit of the bamra or bamrb register. if asid is included in the conditions, this is set in the basma or basmb bit of the bamra or bamrb register. 3. bus cycle break conditions are set in the bbra or bbrb register. settings are instruction fetch or data access, read or write, and data access size. in the case of an instruction fetch, whether the break is to be made before or after instruction execution is set in the pcba or pcbb bit of the brcr register. 4. for channel b, data can be included in the break conditions. data is set in the bdrb register. if data is to be masked, it is set in the bdmrb register. data inclusion in or exclusion from break conditions is set in the dbeb bit of the brcr register.
126 5. sequential use of channels a and b is set in the seq bit of the brcr. when sequential use is designated, a user break occurs when the channel b conditions are matched after matching of channel a conditions. 6. when a user break occurs, the cmfa and cmfb bits in the brcr register are set to 1. if a break is to be generated again, the cmfa and cmfb bits should be cleared to 0. 7 . 2 ubc register functions 7.2.1 break address register a (bara) bit: 31 30 29 28 27 26 25 24 bit name: baa31 baa30 baa29 baa28 baa27 baa26 baa25 baa24 initial value: r/w: r/w r/w r/w r/w r/w r/w r/w r/w bit: 23 22 21 20 19 18 17 16 bit name: baa23 baa22 baa21 baa20 baa19 baa18 baa17 baa16 initial value: r/w: r/w r/w r/w r/w r/w r/w r/w r/w bit: 15 14 13 12 11 10 9 8 bit name: baa15 baa14 baa13 baa12 baa11 ba10 baa9 baa8 initial value: r/w: r/w r/w r/w r/w r/w r/w r/w r/w bit: 7 6 5 4 3 2 1 0 bit name: baa7 baa6 baa5 baa4 baa3 baa2 baa1 baa0 initial value: r/w: r/w r/w r/w r/w r/w r/w r/w r/w break address register a (bara) is a 32-bit read/write register that stores the virtual address of the channel a break condition. it is not initialized by a reset. bits 31 to 0?reak address a31 to 0 (baa31 to baa0): these bits store the virtual address of the channel a break condition. 7.2.2 break address register b (barb) barb is the break address register for channel b. the bit configuration is the same as for bara.
127 7.2.3 break asid register a (basra) bit: 7 6 5 4 3 2 1 0 bit name: basa7 basa6 basa5 basa4 basa3 basa2 basa1 basa0 initial value: r/w: r/w r/w r/w r/w r/w r/w r/w r/w break asid register a (basra) specifies the asid that serves as the break condition for channel a. it is compared to the asid field of the mmu's pteh register. basra is an 8-bit read/write register. it is not initialized by a reset. bits 7 to 0?reak asid a7 to 0 (basa7 to basa0): these bits store the asid (bits 7 to 0) that is the channel a break condition. 7.2.4 break asid register b (basrb) basrb is the break asid register for channel b. the bit configuration is the same as for basra. 7.2.5 break address mask register a (bamra) bit: 7 6 5 4 3 2 1 0 bit name: basma bama1 bama0 initial value: 0 0 0 0 0 r/w: r/w r/w r/w r/w r/w r/w r/w r/w break address mask register a (bamra) is an 8-bit read/write register that specifies which bits in the break asid specified in basra and which bits in the break address specified in bara are masked. it is not initialized by a reset. bits 7 to 3?eserved: these bits always read 0. the write value should always be 0. bit 2?reak asid mask a (basma): indicates whether the bits of the channel a breakpoint asid7 to asid0 (basa7 to basa0) set in basra are masked. bit 2: basma description 0 basra not masked; all bits included in break condition. 1 all basra bits masked; asid not included in break condition.
128 bits 1 and 0?reak address mask a1 and a0 (bama1 and bama0): these bits indicate which of the channel a break address bits 31? (baa31?aa0) set in bara are masked. bit 1: bama1 bit 0: bama0 description 0 0 bara not masked; all bits included in break condition. 0 1 lowest 10 bits masked and excluded from break condition. 1 0 lowest 12 bits masked and excluded from break condition. 1 1 all bara bits masked; address not included in break condition. 7.2.6 break address mask register b (bamrb) bamrb is the break address mask register for channel b. the bit configuration is the same as for bamra. 7.2.7 break bus cycle register a (bbra) bit: 15 14 13 12 11 10 9 8 bit name: initial value: 0 0 0 0 0 0 0 0 r/w: r r r r r r r r bit: 7 6 5 4 3 2 1 0 bit name: ida1 ida0 rwa1 rwa0 sza1 sza0 initial value: 0 0 0 0 0 0 0 0 r/w: r r r/w r/w r/w r/w r/w r/w the break bus cycle register a (bbra) is a 16-bit read/write register that sets the following three channel a break conditions for channel a: (1) instruction fetch/data access, (2) read/write, and (3) operand size. a reset initializes bbra to h'0000. bits 15 to 6?eserved: these bits always read 0. the write value should always be 0.
129 bits 5 and 4?nstruction fetch/data access select a (ida1 and ida0): these bits select whether to break channel a on instruction fetch and/or data access cycles. bit 5: ida1 bit 4: ida0 description 0 0 no conditions compared (initial value) 1 break on instruction fetch cycle 1 0 break on data access cycle 1 break on either instruction fetch or data access cycle bits 3 and 2?ead/write select a (rwa1 and rwa0): these bits select whether to break channel a on read and/or write cycles. bit 3: rwa1 bit 2: rwa0 description 0 0 no conditions compared (initial value) 1 break on read cycles 1 0 break on write cycles 1 break on both read and write cycles bits 1 and 0?perand size select a (sza1 and sza0): these bits select the bus cycle operand size as a channel a break condition. bit 1: sza1 bit 0: sza0 description 0 0 operand size is not a break condition (initial value) 1 break on byte access 1 0 break on word access 1 break on longword access 7.2.8 break bus cycle register b (bbrb) bbrb is the break bus cycle register for channel b. the bit configuration is the same as for bbra.
130 7.2.9 break data register b (bdrb) bit: 31 30 29 28 27 26 25 24 bit name: bdb31 bdb30 bdb29 bdb28 bdb27 bdb26 bdb25 bdb24 initial value: r/w: r/w r/w r/w r/w r/w r/w r/w r/w bit: 23 22 21 20 19 18 17 16 bit name: bdb23 bdb22 bdb21 bdb20 bdb19 bdb18 bdb17 bdb16 initial value: r/w: r/w r/w r/w r/w r/w r/w r/w r/w bit: 15 14 13 12 11 10 9 8 bit name: bdb15 bdb14 bdb13 bdb12 bdb11 bdb10 bdb9 bdb8 initial value: r/w: r/w r/w r/w r/w r/w r/w r/w r/w bit: 7 6 5 4 3 2 1 0 bit name: bdb7 bdb6 bdb5 bdb4 bdb3 bdb2 bdb1 bdb0 initial value: r/w: r/w r/w r/w r/w r/w r/w r/w r/w break data register b (bdrb) is a 32-bit read/write register that specifies the data that is the break condition for channel b data breaks. bdrb is not initialized by a reset. bdrb bits 31 to 0?reak data b31 to b0 (bdb31 to bdb0): these bits store the data that is the break condition for break channel b. when byte access has been specified by the szb bit in the bbrb register, set the same byte data in bits bdb15?db8 as has been set in bits bdb7?db0. bits bdb31?db16 are ignored when either byte or word access is specified. when the instruction fetch cycle is specified as a channel b break condition, or when the data bus is not included in the conditions according to the dbeb bit specification in brcr (0), the bdrb value is ignored.
131 7.2.10 break data mask register b (bdmrb) bit: 31 30 29 28 27 26 25 24 bit name: bdm31 bdm30 bdm29 bdm28 bdm27 bdm26 bdm25 bdm24 initial value: r/w: r/w r/w r/w r/w r/w r/w r/w r/w bit: 23 22 21 20 19 18 17 16 bit name: bdm23 bdm22 bdm21 bdm20 bdm19 bdm18 bdm17 bdm16 initial value: r/w: r/w r/w r/w r/w r/w r/w r/w r/w bit: 15 14 13 12 11 10 9 8 bit name: bdm15 bdm14 bdm13 bdm12 bdm11 bdm10 bdm9 bdm8 initial value: r/w: r/w r/w r/w r/w r/w r/w r/w r/w bit: 7 6 5 4 3 2 1 0 bit name: bdm7 bdm6 bdm5 bdm4 bdm3 bdm2 bdm1 bdm0 initial value: r/w: r/w r/w r/w r/w r/w r/w r/w r/w break data mask register b (bdmrb) is a 32-bit read/write register that determines which of the bits in the break address set in bdrb are masked. bdmrb is not initialized by a reset. bdmrb bits 31 to 0?reak data mask b31 to b0 (bdmb31 to bdmb0): these bits specify whether bits b31?0 (bdb31 to bdb0) of the channel b break data set in bdrb are masked. set the same values in bdmb15?dmb8 as are set in bdmb7?dmb 0. bits 31 0: bdmbn description 0 channel b break data bit bdbn is included in the break condition. 1 channel b break data bit bdbn is masked and therefore not included in the break condition. n = 31 to 0 notes: 1. when the data bus value is contained in the break conditions, specify the operand size. 2. for byte data, set the same data in bits 0? and bits 8?5 of bdrb and bdmrb. 3. bits 31?6 of bdrb and bdmrb are ignored for byte and word sizes.
132 7.2.11 break control register (brcr) bit: 15 14 13 12 11 10 9 8 bit name: cmfa cmfb pcba initial value: 0 0 0 0 0 0 0 0 r/w: r/w r/w r r r r/w r r bit: 7 6 5 4 3 2 1 0 bit name: dbeb pcbb seq initial value: 0 0 0 0 0 0 0 0 r/w: r/w r/w r r r/w r r r the break control register (brcr) is a 16-bit read/write register that controls user breaks. brcr: 1. determines whether to use channels a and b as two independent channels or as sequential conditions. 2. selects whether to break before or after instruction execution during the instruction fetch cycle. 3. determines whether to include the bdrb register in the channel b comparison conditions. it also has a condition-match flag. a power-on or manual reset initializes brcr to h'0000. bit 15?ondition match flag a (cmfa): set to 1 when the break conditions set in channel a are met. not cleared to 0. to check a flag setting after it has been set, clear it by writing 0. bit 15: cmfa description 0 channel a break conditions do not match. (initial value) 1 channel a break conditions match. bit 14?ondition match flag b (cmfb): set to 1 when the break conditions set in channel b are met. not cleared to 0. to check a flag setting after it has been set, clear it by writing 0. bit 14: cmfb description 0 channel b break conditions do not match. (initial value) 1 channel b break conditions match. bits 13 to 11?eserved: these bits always read 0. the write value should always be 0.
133 bit 10?c break select a (pcba): selects whether to place the channel a instruction fetch cycle break before or after instruction execution. bit 10: pcba description 0 places the channel a pc break before instruction execution. (initial value) 1 places the channel a pc break after instruction execution. bits 9 and 8?eserved: these bits always read 0. the write value should always be 0. bit 7?ata break enable b (dbeb): selects whether to include data bus conditions in the channel b break conditions. bit 7: dbeb description 0 do not include data bus conditions in the channel b conditions. (initial value) 1 include data bus conditions in the channel b conditions. note: when the data bus is not included in the break conditions, the idb1 and idb0 bits of break bus cycle register b (bbrb) should be 10 or 11. bit 6?c break select b (pcbb): selects whether to place the channel b instruction fetch cycle break before or after instruction execution bit 6: pcbb description 0 places the channel b pc break before instruction execution. (initial value) 1 places the channel b pc break after instruction execution. bits 5 and 4?eserved: these bits always read 0. the write value should always be 0. bit 3?equence condition select (seq): selects whether to handle the channel a and b conditions independently or sequentially. when set for sequential, the cmfb flag is set when the channel b condition is matched after the channel a condition has already been matched. bit 3: seq description 0 compare channel a and b conditions independently. (initial value) 1 compare channel a and b conditions sequentially (channel a, then channel b).
134 bits 2 to 0?eserved: these bits always read 0. the write value should always be 0. 7 . 3 ubc operation 7.3.1 user break operation flow the flow from break condition setting to user break trap processing is as follows: 1. in the break conditions, set the break address in the break address register for the relevant channel (bara or barb), the asid corresponding to the break space in the break asid register (basra or basrb), and the address and asid masking method in the break address masking register (bamra or bamrb). if the data bus value is included in the break conditions, set the break data in the break data register (bdrb) and the data mask in the break data mask register (bdmrb). 2. set the break bus conditions in the break bus cycle register (bbra or bbrb). if 00 is set for even one set out of bbra/bbrb register instruction fetch/data access select and read/write select, a user trap break will not be generated in the corresponding channel. set such specifications as pre- or post-execution in the case of instruction fetch, whether the data bus value is to be included in the conditions in the case of data access, and independent or sequential conditions for channels a and b, in the break control register (brcr). set the bbra and bbrb registers only after all other break-related register settings have been completed. if break enabling is set with the bbra and bbrb registers while the break address, data, mask, and other registers are still in their initial post-reset state, a break may occur inadvertently. 3. when a condition is matched, the condition match flag for the relevant channel (cmfa or cmfb) is set. this flag is set by a condition match but is not reset. to confirm setting of the same flag again, therefore, it should first be cleared to 0. 4. when sequential conditions are set, a break is made at the instruction matched by channel b when the channel b condition is matched after matching of the channel a condition. no break is made if the channel b set condition is matched before or at the same time as the channel a condition. with sequential conditions, the condition match flag is set only for channel b, and not for channel a.
135 7.3.2 instruction fetch cycle break 1. making an instruction fetch/read/word setting made in the break bus cycle register (bbra/bbrb) enables an instruction fetch cycle to be set as a break condition. in this case, pre- or post-execution of the instruction can be selected by means of bit pcba/pcbb in the break control register (brcr). 2. when instructions are fetched consecutively, 32 bits (two instructions) are fetched in one bus cycle. in this case, although only one bus cycle is generated, breaks can be set for both instructions by setting the start addresses of the respective instructions in the break address registers (bara and barb). 3. with an instruction subject to a pre-execution break, the break is executed when it has been confirmed that the instruction has been fetched and is to be executed. consequently, an overrun- fetched instruction (an instruction fetched but not executed in the event of a branch or exception) cannot be subject to a break. if an exception when an instruction subject to a break is fetched, exception processing is performed first, and the break is executed only when the instruction is re-executed. since a delayed branch instruction and delay slot instruction are executed as a single instruction, if a pre-execution condition is specified for the delay slot instruction, a break is made before execution of the delayed branch instruction. however, a pre-execution break condition cannot be specified for an rte instruction delay slot instruction. 4. with a post-execution condition, the instruction set as the break condition is executed and a break trap is generated before the next instruction is executed. in the same way, a break cannot be specified for an overrun-fetch instruction. when a post-execution condition is set for a delayed branch instruction, similarly, the break is made after executing the delay slot and before executing the instruction at the branch destination. 5. when an instruction fetch cycle is set for channel b, break data register b (bdrb) is ignored. therefore, break data need not be set for an instruction fetch cycle break. 6. instruction fetch cycle breaks cannot be specified consecutively for a delayed branch instruction and its delay slot.
136 7.3.3 data access cycle break 1. in the case of a data access cycle break, the bits used for comparison with the address bus depend on the break bus cycle register (bbra/bbrb) operand size specification, as follows: operand size compared address not included in conditions (00): for byte address, comparison with address bits a31?0 for word address, comparison with address bits a31?1 for longword address, comparison with address bits a31?2 byte (01): comparison with address bits a31?0 word (10): comparison with address bits a31?1 longword (11): comparison with address bits a31?2 2. when data value is included in break condition in channel b when the data value is included in the break conditions, set the dbeb bit in the break control register (brcr) to 1. in this case, break data register b (bdrb) and break data mask register b (bdmrb) settings are needed in addition to the address condition. a user break trap is generated on a match of the address condition and the data condition. bits idb1 and idb0 of break bus cycle register b (bbrb) should be set to 00 or 01. when byte data is specified, set the same data in the two bytes comprising bits 15? and bits 7? in break data register b (bdrb) and break mask register b (bdmrb). if word or byte is designated, bits 31?6 of bdrb and bdmrb are ignored.
137 7.3.4 saved program counter (pc) value 1. when instruction fetch (pre-execution) is set as break condition the program counter (pc) value saved in the spc in user break interrupt handling is the address of the instruction for which the break condition matched. in this case, the fetched instruction is not executed, due to the user break interrupt generated prior to its execution. in the fetch cycle of an instruction located in the delay slot of a delayed branch instruction, a break is generated before the branch, so that the spc value indicates the delayed branch instruction. 2. when instruction fetch (post-execution) is set as break condition the program counter (pc) value saved in the spc in user break interrupt processing is the address of the next instruction to be executed after the instruction for which the break condition matched. in this case, the fetched instruction is executed, and a user break trap occurs before execution of the next instruction. when a delayed branch instruction is designated, the delay slot instruction is executed and a user break occurs before execution of the instruction at the branch destination. in this case, the pc value saved in the spc is the address of the branch destination instruction. 3. when data access (address only) is set as break condition the value saved is the address of the next instruction to be executed after the instruction for which the condition matched. the condition-matching instruction is executed, and a user break trap occurs before execution of the next instruction. 4. when data access (address + data ) is set as break condition the value saved is the start address of the next instruction after the instruction for which execution has been completed when user break trap processing is initiated. when a data value is set as a break condition, the point at which the break is to be made cannot be specified. a break is executed before execution of the instruction fetched around the time of the break data access. 7.3.5 examples of use register settings, set conditions, and states in which the set conditions are matched, are as follows: 1. instruction fetch cycle break condition setting (independent channel a and b conditions) brcr = h'0400: independent channel a and b conditions, post-execution for channel a, pre- execution for channel b channel a: basra = h'80: asid h'80 bara = h'00000404: address h'00000404 bamra = h'00: address mask h'00 bbra = h'0014: bus cycle, instruction fetch (post-execution), read (operand size not included in conditions) channel b: basrb = h'70: asid h'70 barb = h'00008010: address h'00008010
138 bamrb = h'02: address mask h'02 bbrb = h'0014: bus cycle, instruction fetch (pre-execution), read (operand size not included in conditions) bdrb = h'00000000: data h'00000000 bdmrb = h'00000000: data mask h'00000000 a user break is generated after execution of the instruction at address h'00000404 with asid= h'80, or before execution of instructions at addresses h'00008000 to h'000083fe with asid = h'70. 2. instruction fetch cycle break condition setting (independent channel a and b conditions) brcr = h'0080: channel a ? channel b sequential conditions, pre-execution for channel a, pre-execution for channel b channel a: basra = h'80: asid h'80 bara = h'00037226: address h'00037226 bamra = h'00: address mask h'00 bbra = h'0016: bus cycle, instruction fetch (pre-execution), read, word channel b: basrb = h'70: asid h'70 barb = h'0003722e: address h'0003722e bamrb = h'00: address mask h'00 bbrb = h'0016: bus cycle, instruction fetch (pre-execution), read, word bdrb = h'00000000: data h'00000000 bdmrb = h'00000000: data mask h'00000000 a user break is generated before execution of the instruction at address h'0003722e with asid = h'70, after execution of the instruction at address h'00037226 with asid = h'80. 3. data access cycle break condition setting brcr = h'0080: independent channel a and b conditions, data break enable channel a: basra = h'80: asid h'80 bara = h'00123456: address h'00123456 bamra = h'00: address mask h'00 bbra = h'0024: bus cycle, data access, read (operand size not included in conditions) channel b: basrb = h'70: asid h'70 barb = h'000abcde: address h'000abcde bamrb = h'02: address mask h'02 bbrb = h'002a: bus cycle, data access, write, word bdrb = h'0000a512: data h'0000a512, (data break enable) bdmrb = h'00000000: data mask h'00000000
139 for channel a, a user break trap occurs when asid = h'80 and a longword read is performed at address h'00123454, a word read is performed at address h'00123456, or a byte read is performed at address h'00123456. for channel b, a user break trap occurs when asid = h'70 and h'a512 is written anywhere in addresses h'000ab000 to h'000abffe. 4. instruction fetch cycle break condition setting (example of setting error) brcr = h'0000: independent channel a and b conditions, pre-execution for channel a, pre- execution for channel b channel a: basra = h'80: asid h'80 bara = h'00027128 address h'00027128 bamra = h'00: address mask h'00 bbra = h'001a: bus cycle, instruction fetch (pre-execution), write, word channel b: basrb = h'70: asid h'70 barb = h'00031415 address h'00031415 bamrb = h'00: address mask h'00 bbrb = h'0014: bus cycle, instruction fetch (pre-execution), read, (operand size not included in conditions) bdrb = h'00000000: data h'00000000 bdmrb = h'00000000: data mask h'00000000 for channel a, a user break trap does not occur since an instruction fetch is not a write cycle. for channel b, a user break trap does not occur since an instruction fetch is performed on an even address. 7.3.6 cautions 1. if pre-execution is specified for one channel and post-execution for the other for the same address, a pre-execution break will be generated but the condition match flag will be set for both channels. 2. do not set consecutive pc breaks for a delayed branch instruction and a delay slot instruction. 3. if a pc break (post-execution condition) is set for the trapa instruction, the condition match flag will be set but a break will not be executed. the trap instruction will be processed correctly. 4. if data access (address + data) is set as a break condition, and an exception is generated by the instruction (including the delay slot for a delayed branch instruction) following that at which that break condition was matched, the condition match flag will be set but a break will not be executed. the exception generated after the break will be processed correctly.
140 5. if data access (address + data) is set as a break condition, and the instruction following that at which that break condition was matched is a sleep instruction, the condition match flag will be set but a break will not be executed. the sleep instruction will be processed correctly. 6. if an instruction fetch (halt after execution) is set as a break condition, and a nonmaskable interrupt is detected at the instruction following that at which that break condition was matched, the condition match flag will be set but a break will not be executed. the nonmaskable interrupt will be processed correctly. 7. when a sequential break setting is made, a condition match occurs on a channel b match in a bus cycle after that in which a channel a match occurred. therefore, a condition match will not be recognized if bus cycles occurring simultaneously in channel a and b are designated. also, since the cpu has a pipeline structure, the order of instruction fetch and data access cycles is determined by the pipeline. with sequential conditions, therefore, the sequential conditions will be taken as being matched as long as the respective channel conditions match in the order in which the bus cycles occur. 8. with an emulator, the ubc is used on the emulator system side in order to implement the emulator? break functions. consequently, no ubc functions can be used when an emulator is used.
141 section 8 power-down modes 8 . 1 overview in the power-down modes, all cpu and some on-chip supporting module functions are halted. this lowers power consumption. 8.1.1 power-down modes the sh7708 series have the following power-down modes: 1. sleep mode 2. standby mode 3. module standby function (tmu, rtc, and sci on-chip supporting modules) 4. hardware standby mode (sh7708s, sh7708r only) table 8.1 shows the transition conditions for entering the modes from the program execution state, as well as the cpu and supporting module states in each mode and the procedures for canceling each mode.
142 table 8.1 power-down modes state mode transition conditions cpg cpu cpu reg- ister on-chip memory on-chip periphera l modules pins external memory canceling procedure sleep mode execute sleep instruction with stby bit cleared to 0 in stbcr runs halts (reg- ister held) held held run held refresh 1. interrupt 2. reset standby mode execute sleep instruction with stby bit set to 1 in stbcr halts halts (reg- ister held) held held halts* 1 held self- refresh 1. interrupt 2. reset hardware standby mode drive ca pin low halts halts (reg- ister held) held held halts* 3 held self- refresh power-on reset module standby set mstp bit of stbcr to 1 runs runs held held specified module halts * 2 refresh 1. clear mstp bit to 0 2. reset notes: 1. the rtc still runs if the start bit in rcr2 is set to 1 (see section 12, realtime clock (rtc)). tmu still runs when output of the rtc is used as input to its counter (see section 11, timer (tmu)). 2. depends on the on-chip supporting module. tmu external pin: held sci external pin: reset 3. the rtc still runs if the start bit in rcr2 is set to 1 (see section 12, realtime clock (rtc)). the tmu does not run. 8.1.2 register configuration table 8.2 shows the configuration of the control register for the power-down modes. table 8.2 register configuration name abbreviation r/w initial valueaddress access size standby control register stbcr r/w h'00* h'ffffff82 byte note: initialized by a power-on reset. in a manual reset, the register contents are retained.
143 8.1.3 pin configuration table 8.3 lists the pins used for the power-down modes. table 8.3 pin configuration processing status 1 pin (status1) processing status 0 pin (status0) i / o processor operating status high high o reset low sleep mode low high standby mode low normal operation note: the ?ormal operation?status applies during refresh cycles even in sleep mode. 8 . 2 register description 8.2.1 standby control register (stbcr) the standby control register (stbcr) is an 8-bit read/write register that sets the power-down mode. stbcr is initialized to h'00 by a power-on reset. always set bits 6? to 0 when writing to the stbcr register. bit: 7 6 5 4 3 2 1 0 bit name: stby mstp2 mstp1 mstp0 initial value: 0 0 0 0 0 0 0 0 r/w: r/w r r r r r/w r/w r/w bit 7?tandby (stby): specifies transition to standby mode. bit 7: stby description 0 executing sleep instruction puts the chip into sleep mode. (initial value) 1 executing sleep instruction puts the chip into standby mode. bits 6 to 3?eserved: these bits always read 0. the write value should always as 0.
144 bit 2?odule standby 2 (mstp2): specifies halting the clock supply to the timer unit tmu (an on-chip supporting module). when the mstp2 bit is set to 1, the supply of the clock to the tmu is halted. bit 2: mstp2 description 0 tmu runs. (initial value) 1 clock supply to tmu is halted. bit 1?odule standby 1 (mstp1): specifies halting the clock supply to the realtime clock rtc (an on-chip supporting module). when the mstp1 bit is set to 1, the supply of the clock to rtc is halted. when the clock halts, all rtc registers become inaccessible, but the counter keeps running. bit 1: mstp1 description 0 rtc runs. (initial value) 1 clock supply to rtc is halted. bit 0?odule standby 0 (mstp0): specifies halting the clock supply to the serial communication interface sci (an on-chip supporting module). when the mstp0 bit is set to 1, the supply of the clock to the sci is halted. bit 0: mstp0 description 0 sci operates. (initial value) 1 clock supply to sci is halted.
145 8 . 3 sleep mode 8.3.1 transition to sleep mode executing the sleep instruction when the stby bit in stbcr is 0 causes a transition from the program execution state to sleep mode. although the cpu halts immediately after executing the sleep instruction, the contents of its internal registers remain unchanged. the on-chip supporting modules continue to run during sleep mode and the clock continues to be output to the ckio pin. in sleep mode, the status1 pin is set high and the status0 pin low. however, during a refresh cycle, the status1 pin and status0 pin are both set low. 8.3.2 canceling sleep mode sleep mode is canceled by an interrupt (nmi, irl, on-chip supporting module) or reset. interrupts are accepted during sleep mode even when the bl bit in the sr register is 1. canceling with an interrupt: when an nmi, irl or on-chip supporting module interrupt occurs, sleep mode is canceled and interrupt exception handling is executed. a code indicating the interrupt source is set in the intevt register. canceling with a reset: sleep mode is canceled by a power-on reset or a manual reset. 8 . 4 standby mode 8.4.1 transition to standby mode to enter standby mode, set the stby bit to 1 in stbcr, then execute the sleep instruction. the chip moves from the program execution state to standby mode. in standby mode, power consumption is greatly reduced by halting not only the cpu, but the clock and on-chip supporting modules as well. the clock output from the ckio pin also halts. cpu and cache register contents are held, but some on-chip supporting modules are initialized. table 8.4 lists the states of registers in standby mode.
146 table 8.4 register states in standby mode module registers initialized registers retaining data interrupt controller all registers break controller all registers bus state controller all registers on-chip clock pulse generator all registers timer unit tstr register registers other than tstr realtime clock all registers the procedure for moving to standby mode is as follows: 1. clear the tme bit in the wdt? timer control register (wtcsr) to 0 to stop the wdt. set the wdt? timer counter (wtcnt) and the cks2?ks0 bits of the wtcsr register to appropriate values to secure the specified oscillation settling time. 2. when pll circuit 1 is running in clock modes 3?, clear the pstby and pllen bits in the frequency control register (frqcr) to 0 to stop pll circuit 1. 3. after the stby bit in the stbcr register is set to 1, a sleep instruction is executed. 4. standby mode is entered and the clocks within the chip are halted. the status1 pin output goes low and the status0 pin output goes high. 8.4.2 canceling standby mode standby mode is canceled by an interrupt (nmi, irl, or on-chip supporting module) or a reset. canceling with an interrupt: the on-chip wdt can be used for hot starts. when the chip detects an nmi, irl, *1 or on-chip supporting module (except the interval timer) *2 interrupt, the clock will be supplied to the entire chip and standby mode canceled after the time set in the wdt? timer control/status register has elapsed. the status1 and status0 pins both go low. interrupt handling then begins and a code indicating the interrupt source is set in the intevt register. interrupts are accepted during standby mode even when the bl bit in the sr register is 1. immediately after an interrupt is detected, the phase of the clock output of the ckio pin may be unstable, until the processor starts interrupt handling. (the canceling condition is that the irl3?rl0 level is higher than the mask level in the i3?0 bits in the sr register.) notes: 1. when the rtc is being used, standby mode can be canceled using irl3?rl0. 2. standby mode can be canceled with an rtc or tmu (only when running on the rtc clock) interrupt.
147 canceling with a reset: standby mode can be canceled with a reset (power-on or manual). keep the reset pin low until the clock oscillation settles. the internal clock will continue to be output to the ckio pin. 8.4.3 clock pause function in standby mode, the clock input from the extal pin or ckio pin can be halted and the frequency can be changed. this function is used as follows: 1. enter standby mode using the appropriate procedures. 2. once standby mode is entered and the clock stopped within the chip, the status1 pin output is low and the status0 pin output is high. 3. once the status1 pin goes low and the status0 pin goes high, the input clock is stopped or the frequency is changed. 4. when the frequency is changed, an nmi or irl interrupt is input after the change. when the clock is stopped, the same interrupts are input after the clock is applied. 5. after the time set in the wdt has elapsed, the clock starts being applied internally within the chip, the status1?tatus0 pins both go low, interrupts are handled, and operation resumes. 8 . 5 module standby function 8.5.1 transition to module standby function setting the standby control register mstp2?stp0 bits to 1 halts the supply of clocks to the corresponding on-chip supporting modules. this function can be used to reduce the power consumption in sleep mode. the module standby function holds the status prior to halt of the external pins of the on-chip supporting modules. tmu external pins hold their status prior to the halt. sci external pins go to the reset state. with a few exceptions, all registers hold their values. bit value description mstp2 0 tmu runs. 1 supply of clock to tmu is halted. registers are initialized. *1 mstp1 0 rtc runs. 1 supply of clock to rtc is halted. register access is prohibited. *2 mstp0 0 sci operates. 1 supply of clock to sci is halted. notes: 1. the registers initialized are the same as in standby mode (table 8.4). 2. the counter runs.
148 8.5.2 clearing the module standby function the module standby function can be cleared by clearing the mstp2?stp0 bits to 0, or by a power-on reset or manual reset. 8 . 6 timing of status pin changes the timing of status1 and status0 pin changes is shown in figures 8.1 through 8.9. the meaning of the status descriptions is as follows: reset: hh (status1 high, status0 high) sleep: hl (status1 high, status0 low) standby: lh (status1 low, status0 high) normal: ll (status1 low, status0 low) the meaning of the clock units is as follows: bcyc: bus clock cycle pcyc: peripheral clock cycle 8.6.1 timing for resets power-on reset (clock modes 0, 1, 2, and 7): ckio reset status normal normal reset pll settling time 0 to 5 bcyc 0 to 30 bcyc figure 8.1 power-on reset (clock mode 0, 1, 2, and 7) status output
149 power-on reset (clock modes 3 and 4): ckio reset status normal normal reset 0 to 5 bcyc 0 to 30 bcyc figure 8.2 power-on reset (clock mode 3 and 4) status output manual reset: ckio reset status normal normal reset 0 bcyc or more* 0 to 30 bcyc during manual reset, status becomes hh (reset) and the internal reset begins after waiting for the executing bus cycle to end. note: figure 8.3 manual reset status output
150 8.6.2 timing for canceling standbys standby to interrupt: ckio status normal normal wdt count oscillation stops standby interrupt request wdt overflow figure 8.4 standby to interrupt status output standby to power-on reset: ckio status normal normal oscillation stops standby 0 to 10 bcyc 0 to 30 bcyc reset reset reset * when standby mode is cleared with a power-on reset, the wdt does not count. keep reset low during the plls oscillation settling time. * : undefined note: * figure 8.5 standby to power-on reset status output
151 standby to manual reset: ckio status normal normal oscillation stops standby reset 0 to 20 bcyc reset reset * when standby mode is cleared with a manual reset, the wdt does not count. keep reset low during the plls oscillation settling time. note: figure 8.6 standby to manual reset status output 8.6.3 timing for canceling sleep mode sleep to interrupt: ckio status normal normal sleep interrupt request figure 8.7 sleep to interrupt status output
152 sleep to power-on reset: ckio status normal normal sleep 0 to 10 bcyc 0 to 30 bcyc reset reset * reset * when the pll1s multiplication ratio is changed by a power-on reset, keep reset low during the plls oscillation settling time. * : undefined note: figure 8.8 sleep to power-on reset status output sleep to manual reset: ckio 0 to 30 bcyc 0 to 30 bcyc reset status normal normal sleep reset reset * keep reset low until the status becomes reset. note: figure 8.9 sleep to manual reset status output
153 8 . 7 hardware standby mode the hardware standby mode is provided only in the sh7708s and sh7708r. this mode is not supported in emulator. 8.7.1 transition to hardware standby mode driving the ca pin low causes a transition to hardware standby mode. in hardware standby mode, all modules except those operating on an rtc clock are halted, as in the standby mode entered on execution of a sleep instruction. hardware standby mode differs from standby mode as follows. 1. interrupts and manual resets are not accepted. 2. the tclk clock output is fixed low. 3. the tmu does not operate. 4. the rtc continues to operate even if power is not supplied to power supply pins other than those for rtc power. in this case, all output pins go to the non-drive state. operation when a low-level signal is input at the ca pin depends on the cpg state, as follows. 1. in standby mode the clock remains stopped and the chip enters the hardware standby state. acceptance of interrupts and manual resets is disabled, tclk output is fixed low, and the tmu halts. 2. during wdt operation when standby mode is canceled by an interrupt the chip enters hardware standby mode after standby mode is canceled and the cpu resumes operation. 3. in sleep mode the chip enters hardware standby mode after sleep mode is canceled and the cpu resumes operation. 4. during pll standby (see section 9.6 for the pll standby function) the chip enters hardware standby mode after forced implementation of the pll off state. hold the ca pin low in hardware standby mode.
154 8.7.2 canceling hardware standby mode hardware standby mode can only be canceled by a power-on reset. when the ca pin is driven high while the reset pin is low and the breq pin is high, clock oscillation is started. hold the reset pin low until clock oscillation stabilizes. when the reset pin is driven high, the cpu begins power-on reset processing. hardware standby mode cannot be canceled by an interrupt or manual reset. 8.7.3 hardware standby mode timing figures 8.10 and 8.11 show examples of pin timing in hardware standby mode. the ca pin is sampled using extal2 (32.768 khz), and a hardware standby request is only recognized when the pin is low for two consecutive clock cycles. the ca pin must be held low while the chip is in hardware standby mode. clock oscillation starts when the ca pin is driven high after the reset pin is driven low. ckio ca reset status normal standby reset 0 to 10 bcyc undefined rcyc: extal2 (32.768 khz) cycle 2 rcyc or more figure 8.10 hardware standby mode timing (when ca goes low in normal operation)
155 normal standby undefined reset 0 to 10 bcyc wdt operation standby ckio ca reset status 2 rcyc or more figure 8.11 hardware standby mode timing (when ca goes low during wdt operation on standby mode cancellation)
156
157 section 9 on-chip oscillation circuits 9 . 1 overview the clock pulse generator (cpg) supplies all clocks to the processor and controls the power-down modes. the watchdog timer (wdt) is a single-channel timer that counts the clock settling time and is used when clearing standby mode and temporary standbys, such as frequency changes. it can also be used as an ordinary watchdog timer or interval timer. 9.1.1 features the cpg has the following features: six clock modes: selection of six clock modes for different frequency ranges, power consumption, direct crystal input, and external clock input. three clocks generated independently: an internal clock for the cpu, cache, and tlb (i f ); a peripheral clock (p f ) for the on-chip supporting modules; and a bus clock (cki0) for the external bus interface. frequency change function: internal and peripheral clock frequencies can be changed independently using the pll circuit and divider circuit within the cpg. frequencies are changed by software using frequency control register (frqcr) settings. pll on/off function: power consumption can be decreased by stopping the pll circuit when operating at low frequencies. power-down mode control: the clock can be stopped for sleep mode and standby mode and specific modules can be stopped using the module standby function. the wdt has the following features: can be used to ensure the clock settling time: use the wdt to cancel standby mode and the temporary standbys which occur when the clock frequency is changed. can switch between watchdog timer mode and interval timer mode. generates internal resets in watchdog timer mode: internal resets occur after counter overflow. selection of power-on reset or manual reset. generates interrupts in interval timer mode: internal timer interrupts occur after counter overflow. selection of eight counter input clocks. eight clocks ( 1 to 1/4096) can be obtained by dividing the peripheral clock.
158 9 . 2 overview of the cpg 9.2.1 cpg block diagram a block diagram of the on-chip clock pulse generator is shown in figure 9.1(sh7708, sh7708s) and figure 9.2(sh7708r). cap1 ckio cycle = bcyc cap2 xtal extal md2 md1 md0 frqcr internal bus bus interface stbcr pll circuit 1 ( 1, 2, 4) divider 1 internal clock (i f ) cycle = icyc peripheral clock (p f ) cycle = pcyc standby control divider 2 clock pulse generator pll circuit 2 ( 1, 4) crystal oscillator cpg control unit clock frequency control circuit standby control circuit 1 1/2 1/4 1 1/2 1/4 frqcr: frequency control register stbcr: standby control register figure 9.1 block diagram of clock pulse generator(sh7708, sh7708s)
159 cap1 ckio cycle = bcyc cap2 xtal extal md2 md1 md0 frqcr internal bus bus interface stbcr pll circuit 1 ( 1, 2, 3,4) divider 1 internal clock (i f ) cycle = icyc peripheral clock (p f ) cycle = pcyc standby control divider 2 clock pulse generator pll circuit 2 ( 1, 4) crystal oscillator cpg control unit clock frequency control circuit standby control circuit 1 1/2 1/3 1/4 1 1/2 1/3 1/4 frqcr: frequency control register figure 9.2 block diagram of clock pulse generator(sh7708r) the clock pulse generator blocks function as follows: 1. pll circuit 1: pll circuit 1 doubles, triples*, quadruples, or leaves unchanged the input clock frequency from the ckio terminal. the multiplication rate is set by the frequency control register. when this is done, the phase of the leading edge of the internal clock is controlled so that it will agree with the phase of the leading edge of the ckio pin. note: sh7708r only 2. pll circuit 2: pll circuit 2 leaves unchanged or quadruples the frequency of the crystal oscillator or the input clock frequency coming from the extal pin. the multiplication ratio
160 is fixed by the clock operation mode. the clock operation mode is set by pins md0, md1, and md2. see table 9.3 for more information on clock operation modes. 3. crystal oscillator: this oscillator is used when a crystal oscillator element is connected to the xtal and extal pins. it operates according to the clock operating mode setting. 4. divider 1: divider 1 generates a clock at the operating frequency used by the internal clock. the operating frequency can be 1, 1/2, 1/3*, or 1/4 times the output frequency of pll circuit 1, as long as it stays at or above the clock frequency of the ckio pin. the division ratio is set in the frequency control register. note: sh7708r only 5. divider 2: divider 2 generates a clock at the operating frequency used by the peripheral clock. the operating frequencies can be 1, 1/2, 1/3*, or 1/4 times the output frequency of pll circuit 1 or the clock frequency of the ckio pin, as long as it stays at or below the clock frequency of the ckio pin. the division ratio is set in the frequency control register. note: sh7708r only 6. clock frequency control circuit: the clock frequency control circuit controls the clock frequency using the md pin and the frequency control register. 7. standby control circuit: the standby control circuit controls the status of the clock pulse generator and other modules during clock switching and sleep/standby modes. 8. frequency control register: the frequency control register has control bits assigned for the following functions: clock output/non-output from the ckio pin, on/off control of pll circuit 1, pll standby, the frequency multiplication ratio of pll 1, and the frequency division ratio of the internal clock and the peripheral clock. 9. standby control register: the standby control register has bits for controlling the power-down modes. see section 8, power-down modes, for more information.
161 9.2.2 cpg pin configuration table 9.1 lists the cpg pins and their functions. table 9.1 clock pulse generator pins and functions pin name symbol i / o description mode control md0 i set the clock operating mode. pins md1 i md2 i crystal i/o pins xtal o connects a crystal oscillator. (clock input pins) extal i connects a crystal oscillator. also used to input an external clock. clock i/o pin ckio i/o inputs or outputs an external clock. level can be fixed during output. capacitor connection pins cap1 i connects capacitor for pll circuit 1 operation (recommended value 470 pf). for pll cap2 i connects capacitor for pll circuit 2 operation (recommended value 470 pf). 9.2.3 cpg register configuration table 9.2 shows the cpg register configuration. table 9.2 register configuration register name abbreviatio n r/w initial value* address access size frequency control register frqcr r/w h'0102 h'ffffff80 16 note: initialized by a power-on reset via the reset pin. register contents are retained in a power- on reset initiated by the wdt.
162 9 . 3 clock operating modes table 9.3 shows the relationship between the mode control pin (md2?d0) combinations and the clock operating modes. table 9.4 shows the usable frequency ranges in the clock operating modes. table 9.3 clock operating modes pin values clock i/o pll2 div- pll1 divider 1 divider 2 ckio mod e md 2 md 1 md 0 sourceoutput on/off ider 3 on/offinput input frequenc y 0 0 0 0 extal ckio on multi- plication ratio: 1 off on pll1 output pll1 (extal) 1 0 0 1 extal ckio on multi- plication ratio: 4 off on pll1 output pll1 (extal) 4 2 0 1 0 crystal oscillato r ckio on multi- plication ratio: 4 off on pll1 output pll1 (crystal) 4 3 0 1 1 extal ckio on multi- plication ratio: 1 off off (initial value) pll2 output pll2 (extal) 1 on pll1 output 4 1 0 0 crystal oscillato r ckio on multi- plication ratio: 1 off off (initial value) pll2 output pll2 (crystal) 1 on pll1 output 7 1 1 1 ckio off off on pll1 output pll1 (ckio) mode 0: an external clock is input from the extal pin and undergoes waveform shaping by pll circuit 2 before being supplied inside the sh7708 series. pll circuit 1 is constantly on, and there are no frequency range restrictions compared to mode 3. an input clock frequency of 8 mhz to 60 mhz(sh7708, sh7708s) or 16 mhz to 60 mhz(sh7708r) can be used, and the ckio frequency range is 8 mhz to 60 mhz(sh7708, sh7708s) or 16 mhz to 60 mhz(sh7708r).
163 as pll circuit 1 compensates for fluctuations in the ckio pin load, this mode is suitable for connection of synchronous dram. mode 1: an external clock is input from the extal pin and its frequency is multiplied by 4 by pll circuit 2 before being supplied inside the sh7708 series, allowing a low-frequency external clock to be used. an input clock frequency of 5 mhz to 15 mhz can be used, and the ckio frequency range is 20 mhz to 60 mhz. as pll circuit 1 compensates for fluctuations in the ckio pin load, this mode is suitable for connection of synchronous dram. mode 2: the on-chip crystal oscillator operates, with the oscillation frequency being multiplied by 4 by pll circuit 2 before being supplied inside the sh7708 series, allowing a low crystal frequency to be used. a crystal oscillation frequency of 5 mhz to 15 mhz can be used, and the ckio frequency range is 20 mhz to 60 mhz. as pll circuit 1 compensates for fluctuations in the ckio pin load, this mode is suitable for connection of synchronous dram. mode 3: an external clock is input from the extal pin and undergoes waveform shaping by pll circuit 2 before being supplied inside the sh7708 series. pll circuit 1 is off in the default state at power-on reset, and pll circuit 1 can be selected as on or off, enabling power consumption to be kept lower than in mode 0. an input clock frequency of 8 mhz to 15 mhz(sh7708, sh7708s) or 16 mhz to 25 mhz(sh7708r) can be used, and the ckio frequency range is of 8 mhz to 15 mhz(sh7708, sh7708s) or 16 mhz to 25 mhz(sh7708r). mode 4: the on-chip crystal oscillator operates, with its output supplied inside the sh7708 series as a square waveform by pll circuit 2. pll circuit 1 is off in the default state at power-on reset, and pll circuit 1 can be selected as on or off, enabling power consumption to be reduced accordingly. a crystal oscillation frequency of of 8 mhz to 15 mhz(sh7708, sh7708s) or 16 mhz to 25 mhz(sh7708r) can be used, and the ckio frequency range is of 8 mhz to 15 mhz(sh7708, sh7708s) or 16 mhz to 25 mhz(sh7708r). mode 7: in this mode, the ckio pin is an input, an external clock is input to this pin, and undergoes waveform shaping, and also frequency multiplication according to the setting, by pll circuit 1 before being supplied to the sh7708 series. in modes 0 to 6, the system clock is generated from the output of the sh7708 series?ckio pin. consequently, if a large number of ics are operating on the clock cycle, the ckio pin load will be large. this mode, however, assumes a comparatively large-scale system. if a large number of ics are operating on the clock cycle, a clock generator with a number of low-skew clock outputs can be provided, so that the ics can operate synchronously by distributing the clocks to each one. as pll circuit 1 compensates for fluctuations in the ckio pin load, this mode is suitable for connection of synchronous dram.
164 table 9.4 range of usable frequencies for each clock operating mode(sh7708, sh7708s) mode frqcr register value pll1 pll2 clock ratio* 1 (i:b:p) input clock/ crystal oscillator frequency range ckio pin frequency range 0 h'0102 h'0101 h'0100 on ( 1) on ( 1) on ( 1) on ( 1) on ( 1) on ( 1) 1:1:1/4 1:1:1/2 1:1:1 8 mhz to 60 mhz 8 mhz to 60 mhz 8 mhz to 30 mhz 8 mhz to 60 mhz 8 mhz to 60 mhz 8 mhz to 30 mhz h'0112 h'0111 h'0115 h'0116 on ( 2) on ( 2) on ( 2) on ( 2) on ( 1) on ( 1) on ( 1) on ( 1) 2:1:1/2 2:1:1 1:1:1 1:1:1/2 8 mhz to 30 mhz 8 mhz to 30 mhz 8 mhz to 30 mhz 8 mhz to 30 mhz 8 mhz to 30 mhz 8 mhz to 30 mhz 8 mhz to 30 mhz 8 mhz to 30 mhz h'0122 h'0126 h'012a on ( 4) on ( 4) on ( 4) on ( 1) on ( 1) on ( 1) 4:1:1 2:1:1 1:1:1 8 mhz to 15 mhz 8 mhz to 15 mhz 8 mhz to 15 mhz 8 mhz to 15 mhz 8 mhz to 15 mhz 8 mhz to 15 mhz 1, 2 h'0102 h'0101 h'0100 on ( 1) on ( 1) on ( 1) on ( 4) on ( 4) on ( 4) 4:4:1 4:4:2 4:4:4 5 mhz to 15 mhz 5 mhz to 15 mhz 5 mhz to 7.5 mhz 20 mhz to 60 mhz 20 mhz to 60 mhz 20 mhz to 30 mhz h'0112 h'0111 h'0115 h'0116 on ( 2) on ( 2) on ( 2) on ( 2) on ( 4) on ( 4) on ( 4) on ( 4) 8:4:2 8:4:4 4:4:4 4:4:2 5 mhz to 7.5 mhz 5 mhz to 7.5 mhz 5 mhz to 7.5 mhz 5 mhz to 7.5 mhz 20 mhz to 30 mhz 20 mhz to 30 mhz 20 mhz to 30 mhz 20 mhz to 30 mhz 3, 4 h'0102 h'0101 h'0100 off off off on ( 1) on ( 1) on ( 1) 1:1:1/4 1:1:1/2 1:1:1 8 mhz to 15 mhz 8 mhz to 15 mhz 8 mhz to 15 mhz 8 mhz to 15 mhz 8 mhz to 15 mhz 8 mhz to 15 mhz h'01d1 h'01d0 h'01d4 h'01d5 h'01d6 on ( 2) on ( 2) on ( 2) on ( 2) on ( 2) on ( 1) on ( 1) on ( 1) on ( 1) on ( 1) 2:1:1/2 2:1:1 1:1:1 1:1:1/2 1:1:1/4 8 mhz to 15 mhz 8 mhz to 15 mhz 8 mhz to 15 mhz 8 mhz to 15 mhz 8 mhz to 15 mhz 8 mhz to 15 mhz 8 mhz to 15 mhz 8 mhz to 15 mhz 8 mhz to 15 mhz 8 mhz to 15 mhz h'01e0 h'01e4 h'01e5 h'01e8 h'01e9 h'01ea on ( 4) on ( 4) on ( 4) on ( 4) on ( 4) on ( 4) on ( 1) on ( 1) on ( 1) on ( 1) on ( 1) on ( 1) 4:1:4 2:1:1 2:1:1/2 1:1:1 1:1:1/2 1:1:1/4 8 mhz to 15 mhz 8 mhz to 15 mhz 8 mhz to 15 mhz 8 mhz to 15 mhz 8 mhz to 15 mhz 8 mhz to 15 mhz 8 mhz to 15 mhz 8 mhz to 15 mhz 8 mhz to 15 mhz 8 mhz to 15 mhz 8 mhz to 15 mhz 8 mhz to 15 mhz
165 table 9.4 range of usable frequencies for each clock operating mode(sh7708, sh7708s) (cont) mode frqcr register value pll1 pll2 clock ratio* 1 (i:b:p) input clock/ crystal oscillator frequency range ckio pin frequency range 5* 2 h'0102 h'0101 h'0100 off off off off off off 1/2:1/2:1/8 1/2:1/2:1/4 1/2:1/2:1/2 2 mhz to 30 mhz 2 mhz to 30 mhz 2 mhz to 30 mhz 1 mhz to 15 mhz 1 mhz to 15 mhz 1 mhz to 15 mhz h'01d1 h'01d0 h'01d4 h'01d5 h'01d6 on ( 2) on ( 2) on ( 2) on ( 2) on ( 2) off off off off off 1:1/2:1/4 1:1/2:1/2 1/2:1/2:1/2 1/2:1/2:1/4 1/2:1/2:1/8 16 mhz to 30 mhz 16 mhz to 30 mhz 16 mhz to 30 mhz 16 mhz to 30 mhz 16 mhz to 30 mhz 8 mhz to 15 mhz 8 mhz to 15 mhz 8 mhz to 15 mhz 8 mhz to 15 mhz 8 mhz to 15 mhz h'01e2 h'01e6 h'01ea on ( 4) on ( 4) on ( 4) off off off 2:1/2:1/2 1:1/2:1/2 1/2:1/2:1/2 16 mhz to 30 mhz 16 mhz to 30 mhz 16 mhz to 30 mhz 8 mhz to 15 mhz 8 mhz to 15 mhz 8 mhz to 15 mhz 6* 2 h'0102 h'0101 h'0100 off off off off off off 1/2:1/2:1/8 1/2:1/2:1/4 1/2:1/2:1/2 2 mhz to 20 mhz 2 mhz to 20 mhz 2 mhz to 20 mhz 1 mhz to 10 mhz 1 mhz to 10 mhz 1 mhz to 10 mhz h'01d1 h'01d0 h'01d4 h'01d5 h'01d6 on ( 2) on ( 2) on ( 2) on ( 2) on ( 2) off off off off off 1:1/2:1/4 1:1/2:1/2 1/2:1/2:1/2 1/2:1/2:1/4 1/2:1/2:1/8 16 mhz to 20 mhz 16 mhz to 20 mhz 16 mhz to 20 mhz 16 mhz to 20 mhz 16 mhz to 20 mhz 8 mhz to 10 mhz 8 mhz to 10 mhz 8 mhz to 10 mhz 8 mhz to 10 mhz 8 mhz to 10 mhz h'01e2 h'01e6 h'01ea on ( 4) on ( 4) on ( 4) off off off 2:1/2:1/2 1:1/2:1/2 1/2:1/2:1/2 16 mhz to 20 mhz 16 mhz to 20 mhz 16 mhz to 20 mhz 8 mhz to 10 mhz 8 mhz to 10 mhz 8 mhz to 10 mhz 7 h'0102 h'0101 h'0100 on ( 1) on ( 1) on ( 1) off off off 1:1:1/4 1:1:1/2 1:1:1 8 mhz to 60 mhz 8 mhz to 60 mhz 8 mhz to 30 mhz 8 mhz to 60 mhz 8 mhz to 60 mhz 8 mhz to 30 mhz h'0112 h'0111 h'0115 h'0116 on ( 2) on ( 2) on ( 2) on ( 2) off off off off 2:1:1/2 2:1:1 1:1:1 1:1:1/2 8 mhz to 30 mhz 8 mhz to 30 mhz 8 mhz to 30 mhz 8 mhz to 30 mhz 8 mhz to 30 mhz 8 mhz to 30 mhz 8 mhz to 30 mhz 8 mhz to 30 mhz h'0122 h'0126 h'012a on ( 4) on ( 4) on ( 4) off off off 4:1:1 2:1:1 1:1:1 8 mhz to 15 mhz 8 mhz to 15 mhz 8 mhz to 15 mhz 8 mhz to 15 mhz 8 mhz to 15 mhz 8 mhz to 15 mhz notes: 1. taking input clock as 1. maximum frequencies: i?= 60 mhz, b?= 60 mhz, p?= 30 mhz. 2. modes 5 and 6 are available only in the sh7708.
166 table 9.5 range of usable frequencies for each clock operating mode(sh7708r) clock mode frqcr pll1 pll2 clock rate* 1 (i:b:p) input frequency range ckio frequency range 0 h'0100 h'0101 h'0102 on ( 1) on ( 1) on ( 1) on ( 1) on ( 1) on ( 1) 1:1:1 1:1:1/2 1:1:1/4 16 mhz to 33.3 mhz 16 mhz to 60 mhz 16 mhz to 60 mhz 16 mhz to 33.3 mhz 16 mhz to 60 mhz 16 mhz to 60 mhz h'0111 h'0112 h'0115 h'0116 on ( 2) on ( 2) on ( 2) on ( 2) on ( 1) on ( 1) on ( 1) on ( 1) 2:1:1 2:1:1/2 1:1:1 1:1:1/2 16 mhz to 33.3 mhz 16 mhz to 50 mhz 16 mhz to 33.3 mhz 16 mhz to 50 mhz 16 mhz to 33.3 mhz 16 mhz to 50 mhz 16 mhz to 33.3 mhz 16 mhz to 50 mhz h'0122 h'0126 h'012a on ( 4) on ( 4) on ( 4) on ( 1) on ( 1) on ( 1) 4:1:1 2:1:1 1:1:1 16 mhz to 25 mhz 16 mhz to 25 mhz 16 mhz to 25 mhz 16 mhz to 25 mhz 16 mhz to 25 mhz 16 mhz to 25 mhz h?100 h?100 h?101 on ( 3) on ( 3) on ( 3) on ( 1) on ( 1) on ( 1) 3:1:1 1:1:1 1:1:1/2 25 mhz to 33.3 mhz 25 mhz to 33.3 mhz 25 mhz to 33.3 mhz 25 mhz to 33.3 mhz 25 mhz to 33.3 mhz 25 mhz to 33.3 mhz 1, 2 h'0100 h'0101 h'0102 on ( 1) on ( 1) on ( 1) on ( 4) on ( 4) on ( 4) 4:4:4 4:4:2 4:4:1 5 mhz to 8.3 mhz 5 mhz to 15 mhz 5 mhz to 15 mhz 20 mhz to 33.3 mhz 20 mhz to 60 mhz 20 mhz to 60 mhz h'0111 h'0112 h'0115 h'0116 on ( 2) on ( 2) on ( 2) on ( 2) on ( 4) on ( 4) on ( 4) on ( 4) 8:4:4 8:4:2 4:4:4 4:4:2 5 mhz to 8.3 mhz 5 mhz to 12.5 mhz 5 mhz to 8.3 mhz 5 mhz to 12.5 mhz 20 mhz to 33.3 mhz 20 mhz to 50 mhz 20 mhz to 33.3 mhz 20 mhz to 50 mhz h?100 h?100 h?101 on ( 3) on ( 3) on ( 3) on ( 4) on ( 4) on ( 4) 12:4:4 4:4:4 4:4:2 5 mhz to 8.3 mhz 5 mhz to 8.3 mhz 5 mhz to 8.3 mhz 20 mhz to 33.3 mhz 20 mhz to 33.3 mhz 20 mhz to 33.3 mhz 3 h'0100 h'0101 h'0102 off off off on ( 1) on ( 1) on ( 1) 1:1:1 1:1:1/2 1:1:1/4 16 mhz to 25 mhz 16 mhz to 25 mhz 16 mhz to 25 mhz 16 mhz to 25 mhz 16 mhz to 25 mhz 16 mhz to 25 mhz h'01d0 h'01d1 h'01d2 h'01d4 h'01d5 h?1d6 on ( 2) on ( 2) on ( 2) on ( 2) on ( 2) on ( 2) on ( 1) on ( 1) on ( 1) on ( 1) on ( 1) on ( 1) 2:1:1 2:1:1/2 2:1:1/4 1:1:1 1:1:1/2 1:1:1/4 16 mhz to 25 mhz 16 mhz to 25 mhz 16 mhz to 25 mhz 16 mhz to 25 mhz 16 mhz to 25 mhz 16 mhz to 25 mhz 16 mhz to 25 mhz 16 mhz to 25 mhz 16 mhz to 25 mhz 16 mhz to 25 mhz 16 mhz to 25 mhz 16 mhz to 25 mhz
167 table 9.5 range of usable frequencies for each clock operating mode(sh7708r) (cont) clock mode frqcr pll1 pll2 clock rate* 1 (i:b:p) input frequency range ckio frequency range 3 h?1c0 h?1c1 h?1c0 h?1c1 on ( 3) on ( 3) on ( 3) on ( 3) on ( 1) on ( 1) on ( 1) on ( 1) 3:1:1 3:1:1/2 1:1:1 1:1:1/2 16 mhz to 25 mhz 16 mhz to 25 mhz 16 mhz to 25 mhz 16 mhz to 25 mhz 16 mhz to 25 mhz 16 mhz to 25 mhz 16 mhz to 25 mhz 16 mhz to 25 mhz h'01e0 h?1e1 h'01e4 h'01e5 h'01e6 h'01e8 h'01e9 h'01ea on ( 4) on ( 4) on ( 4) on ( 4) on ( 4) on ( 4) on ( 4) on ( 4) on ( 1) on ( 1) on ( 1) on ( 1) on ( 1) on ( 1) on ( 1) on ( 1) 4:1:1 4:1:1/2 2:1:1 2:1:1/2 2:1:1/4 1:1:1 1:1:1/2 1:1:1/4 16 mhz to 25 mhz 16 mhz to 25 mhz 16 mhz to 25 mhz 16 mhz to 25 mhz 16 mhz to 25 mhz 16 mhz to 25 mhz 16 mhz to 25 mhz 16 mhz to 25 mhz 16 mhz to 25 mhz 16 mhz to 25 mhz 16 mhz to 25 mhz 16 mhz to 25 mhz 16 mhz to 25 mhz 16 mhz to 25 mhz 16 mhz to 25 mhz 16 mhz to 25 mhz 4 h'0100 h'0101 h'0102 off off off on ( 1) on ( 1) on ( 1) 1:1:1 1:1:1/2 1:1:1/4 16 mhz to 20 mhz 16 mhz to 20 mhz 16 mhz to 20 mhz 16 mhz to 20 mhz 16 mhz to 20 mhz 16 mhz to 20mhz h'01d0 h'01d1 h'01d2 h'01d4 h'01d5 h?1d6 on ( 2) on ( 2) on ( 2) on ( 2) on ( 2) on ( 2) on ( 1) on ( 1) on ( 1) on ( 1) on ( 1) on ( 1) 2:1:1 2:1:1/2 2:1:1/4 1:1:1 1:1:1/2 1:1:1/4 16 mhz to 20 mhz 16 mhz to 20 mhz 16 mhz to 20 mhz 16 mhz to 20 mhz 16 mhz to 20 mhz 16 mhz to 20 mhz 16 mhz to 20 mhz 16 mhz to 20 mhz 16 mhz to 20 mhz 16 mhz to 20 mhz 16 mhz to 20 mhz 16 mhz to 20 mhz h?1c0 h?1c1 h?1c0 h?1c1 on ( 3) on ( 3) on ( 3) on ( 3) on ( 1) on ( 1) on ( 1) on ( 1) 3:1:1 3:1:1/2 1:1:1 1:1:1/2 16 mhz to 20 mhz 16 mhz to 20 mhz 16 mhz to 20 mhz 16 mhz to 20 mhz 16 mhz to 20 mhz 16 mhz to 20 mhz 16 mhz to 20 mhz 16 mhz to 20 mhz h'01e0 h?1e1 h'01e4 h'01e5 h'01e6 h'01e8 h'01e9 h'01ea on ( 4) on ( 4) on ( 4) on ( 4) on ( 4) on ( 4) on ( 4) on ( 4) on ( 1) on ( 1) on ( 1) on ( 1) on ( 1) on ( 1) on ( 1) on ( 1) 4:1:1 4:1:1/2 2:1:1 2:1:1/2 2:1:1/4 1:1:1 1:1:1/2 1:1:1/4 16 mhz to 20 mhz 16 mhz to 20 mhz 16 mhz to 20 mhz 16 mhz to 20 mhz 16 mhz to 20 mhz 16 mhz to 20 mhz 16 mhz to 20 mhz 16 mhz to 20 mhz 16 mhz to 20 mhz 16 mhz to 20 mhz 16 mhz to 20 mhz 16 mhz to 20 mhz 16 mhz to 20 mhz 16 mhz to 20 mhz 16 mhz to 20 mhz 16 mhz to 20 mhz
168 table 9.4 range of usable frequencies for each clock operating mode(sh7708r) (cont) clock mode frqcr pll1 pll2 clock rate* 1 (i:b:p) input frequency range ckio frequency range 7 h'0100 h'0101 h'0102 on ( 1) on ( 1) on ( 1) off off off 1:1:1 1:1:1/2 1:1:1/4 16 mhz to 33.3 mhz 16 mhz to 60 mhz 16 mhz to 60 mhz 16 mhz to 33.3 mhz 16 mhz to 60 mhz 16 mhz to 60 mhz h'0111 h'0112 h'0115 h'0116 on ( 2) on ( 2) on ( 2) on ( 2) off off off off 2:1:1 2:1:1/2 1:1:1 1:1:1/2 16 mhz to 33.3 mhz 16 mhz to 50 mhz 16 mhz to 33.3 mhz 16 mhz to 50 mhz 16 mhz to 33.3 mhz 16 mhz to 50 mhz 16 mhz to 33.3 mhz 16 mhz to 50 mhz h'0122 h'0126 h'012a on ( 4) on ( 4) on ( 4) off off off 4:1:1 2:1:1 1:1:1 16 mhz to 25 mhz 16 mhz to 25 mhz 16 mhz to 25 mhz 16 mhz to 25 mhz 16 mhz to 25 mhz 16 mhz to 25 mhz h?100 h?100 h?101 on ( 3)) on ( 3) on ( 3) off off off 3:1:1 1:1:1 1:1:1/2 25 mhz to 33.3 mhz 25 mhz to 33.3 mhz 25 mhz to 33.3 mhz 25 mhz to 33.3 mhz 25 mhz to 33.3 mhz 25 mhz to 33.3 mhz notes: 1. input clock frequency is 1 2. max frequency : i f = 100 mhz, b f = (ckio) = 60 mhz, p f = 30 mhz cautions: 1. when clock operating modes 3 and 4 are used: the on/off state of pll circuit 1 is set by the frequency control register. pll circuit 1 is initialized to the off state by a power-on reset. always turn pll circuit 1 off before going into standby mode. 2. the input to divider 1 becomes the output of: pll circuit 1 when pll circuit 1 is on. pll circuit 2 when pll circuit 1 is off and pll circuit 2 is on. divider 3 when pll circuit 1 is off and pll circuit 2 is off. 3. the input of divider 2 becomes the output of: pll circuit 1 when the clock operating mode is 0? or 7. pll circuit 2 when the clock operating mode is 3 and 4 and pll circuit 2 is on. divider 3 when the clock operating mode is 3 and 4 and pll circuit 2 is off. 4. the frequency of the internal clock (i f ) becomes: the product of the frequency of the ckio pin, the frequency multiplication ratio of pll circuit 1, and the division ratio of divider 1 when pll circuit 1 is on.
169 equal to the frequency of ckio pin when pll circuit 1 is off. do not set the internal clock frequency lower than the ckio pin frequency. 5. the frequency of the peripheral clock (p f ) becomes: the product of the frequency of the ckio pin, the frequency multiplication ratio of pll circuit 1, and the division ratio of divider 2 when the clock operating mode is 0? or 7. the product of the frequency of the ckio pin and the division ratio of divider 2 when the clock operating mode is 3 and 4. the peripheral clock frequency should not be set higher than the frequency of the ckio pin, higher than 30 mhz(sh7708, sh7708s) / 33.3 mhz(sh7708r), or lower than 1/4 (sh7708, sh7708s) / 1/8(sh7708r) the internal clock (i f ). 6. the output frequency of pll circuit 1 is the product of the ckio frequency and the multiplication ratio of pll circuit 1. this frequency should be equal to or lower than 60 mhz(sh7708, sh7708s) / 100 mhz(sh7708r). 7. 1, 2, 3* or 4 can be used as the multiplication ratio of pll circuit 1. 1, 1/2, 1/3*, and 1/4 can be selected as the division ratios of dividers 1 and 2. set the rate in the frequency control register. the on/off state of pll circuit 2 is determined by the mode. 3 multiplication of pll circuit 1 and 1/3 of dividers 1 and 2 are not supported in emulator. note: sh7708r only 8. for more in formation about the range of usable freguencies for each clock operating mode,see table 9.4.
170 9 . 4 register descriptions 9.4.1 frequency control register (frqcr) the frequency control register (frqcr) is a 16-bit read/write register used to specify whether a clock is output from the ckio pin, the on/off state of pll circuit 1, pll standby, the frequency multiplication ratio of pll circuit 1, and the frequency division ratio of the internal clock and the peripheral clock. only word access can be used on the frqcr register. frqcr is initialized to h'0102 by a power-on reset, but retains its value in a manual reset and in standby mode. sh7708, sh7708s: bit: 15 14 13 12 11 10 9 8 bit name: ckoen initial value: 0 0 0 0 0 0 0 1 r/w: r r r r r r r r/w bit: 7 6 5 4 3 2 1 0 bit name: pllen pstby stc1 stc0 ifc1 ifc0 pfc1 pfc0 initial value: 0 0 0 0 0 0 1 0 r/w: r/w r/w r/w r/w r/w r/w r/w r/w bit 8?lock enable (ckoen): used to output a clock from the ckio pin or to fix the level of the ckio pin. even when the level is fixed, the sh7708 series will operate internally at the frequency before the level was fixed. in case of clock operating mode 7, the ckio pin becomes an input pin irrespective of the value of this bit. bit 8: ckoen description 0 fixes the level of ckio terminal. 1 outputs a clock from the ckio pin.(initial value) bit 7?ll circuit enable (pllen): specifies the on/off state of pll circuit 1. this bit is valid in clock operating modes 3?. pll circuit 1 goes on when the clock operating mode is 0? or 7 irrespective of the value of pllen.
171 bit 7: pllen description 0 pll circuit 1 is not used.(initial value) 1 pll circuit 1 is used. bit 6?ll standby (pstby): specifies pll standby. when pll standby is active, pll circuit 1 will be in standby mode at the frequency specified by the stc bit. this function is valid in clock operating modes 3?. bit 6: pstby description 0 pll is not in standby mode. (initial value) 1 pll is in standby mode. bits 5 and 4?requency multiplication ratio (stc1, stc0): these bits specify the frequency multiplication ratio of pll circuit 1. bit 5: stc1 bit 4: stc0 description 00 1 (initial value) 01 2 10 4 1 1 setting prohibited (do not set) note: do not set the output frequency of pll circuit 1 higher than 60 mhz. bits 3 and 2?nternal clock frequency division ratio (ifc1, ifc0): these bits specify the frequency division ratio of the internal clock with respect to the output frequency of pll circuit 1. when pll circuit 1 is off or in standby mode, set 1. bit 3: ifc1 bit 2: ifc0 description 00 1 (initial value) 01 1/2 10 1/4 1 1 setting prohibited (do not set) note: do not set the internal clock frequency lower than the ckio frequency. bits 1 and 0?eripheral clock frequency division ratio (pfc1, pfc0): these bits specify the division ratio of the peripheral clock frequency with respect to the frequency of the output frequency of pll circuit 1 or the frequency of the ckio pin.
172 bit 1: pfc1 bit 0: pfc0 description 00 1 01 1/2 10 1/4 (initial value) 1 1 setting prohibited (do not set) note: do not set the peripheral clock frequency higher than the frequency of the ckio pin. sh7708r: bit: 15 14 13 12 11 10 9 8 bit name: stc2 ifc2 pfc2 ckoen initial value: 0 0 0 0 0 0 0 1 r/w: r/w r/w r/w r r r r r/w bit: 7 6 5 4 3 2 1 0 bit name: pllen pstby stc1 stc0 ifc1 ifc0 pfc1 pfc0 initial value: 0 0 0 0 0 0 1 0 r/w: r/w r/w r/w r/w r/w r/w r/w r/w bits 15, 5 and 4?requency multiplication ratio (stc): these bits specify the frequency multiplication ratio of pll circuit 1. bit 15: stc2 bit 5: stc1 bit 4: stc0 description 000 1 (initial value) 001 2 100 3 110 4 note: do not set the output frequency of pll circuit 1 higher than 100mhz. bits 14, 3 and 2?nternal clock frequency division ratio (ifc): these bits specify the frequency division ratio of the internal clock with respect to the output frequency of pll circuit 1. when pll circuit 1 is off or in standby mode, set 1. bit 14: ifc2 bit 2: ifc1 bit 1: ifc0 description 000 1 (initial value) 001 1/2 100 1/3 110 1/4 note: do not set the interunal clock frequency lower then the ckio frequency.
173 bits 13, 1 and 0?eripheral clock frequency division ratio (pfc): these bits specify the division ratio of the peripheral clock frequency with respect to the frequency of the output frequency of pll circuit 1 or the frequency of the ckio pin. bit 13: pfc2 bit 1: pfc1 bit 0: pfc0 description 000 1 001 1/2 100 1/3 110 1/4 note: do not set the peripheral clock frequency higher then the frequency of the ckio pin. bit 8?lock enable (ckoen): used to output a clock in operating mode 3? from the ckio pin or to fix the level of the ckio pin in clock operation modes 3 and 4. even when the level is fixed, the sh7708r will operate internally at the frequency before the level was fixed. in case of clock operating mode 0?, set this bit to 1. in case of clock operating mode 7, the ckio pin becomes an input pin irrespective of the value of this bit. bit 8: ckoen description 0 fixes the level of ckio terminal. 1 outputs a clock from the ckio pin.(initial value) bit 7?ll circuit enable (pllen): specifies the on/off state of pll circuit 1. this bit is valid in clock operating modes 3 and 4. pll circuit 1 goes on when the clock operating mode is 0? or 7 irrespective of the value of pllen. bit 7: pllen description 0 pll circuit 1 is not used.(initial value) 1 pll circuit 1 is used. bit 6?ll standby (pstby): specifies pll standby. when pll standby is active, pll circuit 1 will be in standby mode at the frequency specified by the stc bit. this function is valid in clock operating modes 3 and 4. bit 6: pstby description 0 pll is not in standby mode. (initial value) 1 pll is in standby mode.
174 9 . 5 changing the frequency the frequency of the internal clock and peripheral clock can be changed either by changing the multiplication rate of pll circuit 1 or by changing the division rates of dividers 1 and 2. all of these are controlled by software through the frequency control register. the methods are described below. in modes 3?, the frequency can also be changed by turning pll circuit 1 on and off, as described in section 9.6, pll standby function. 9.5.1 changing the multiplication rate a pll settling time is required when the multiplication rate of pll circuit 1 is changed. the on- chip wdt counts the settling time. 1. in the initial state, the multiplication rate of pll circuit 1 is 1. 2. set a value that will become the specified oscillation settling time in the wdt and stop the wdt. the following must be set: wtcsr register tme bit = 0: wdt stops wtcsr register cks2?ks0 bits: division ratio of wdt count clock wtcnt counter: initial counter value 3. set the desired value in the stc1 and stc0 bits. the division ratio can also be set in the ifc1?fc0 bits and pfc1?fc0 bits. 4. the processor pauses internally and the wdt starts incrementing. in clock modes 0? and 7, the internal and peripheral clocks both stop. in clock modes 3 and 4, only the internal clock stops. the clock will continue to be output at the ckio pin as long as the ckoen bit in the frqcr register is set to 1. 5. supply of the clock that has been set begins at wdt count overflow, and the processor begins operating again. the wdt stops after it overflows. 9.5.2 changing the division ratio the wdt will not count unless the multiplication rate is changed simultaneously. 1. in the initial state, ifc1?fc0 = 00 and pfc1?fc0 = 10. 2. set the ifc1, ifc0, pfc1, and pfc0 bits to the new division ratio. the values that can be set are limited by the clock mode and the multiplication rate of pll circuit 1. note that if the wrong value is set, the processor will malfunction. 3. the clock is immediately supplied at the new division ratio.
175 9 . 6 pll standby function 9.6.1 overview of the pll standby function when operating in clock modes 3 and 4, the internal clock can be controlled by turning the pll1 circuit on and off. a long oscillation settling time is required, however, when the pll circuit is started up from a complete halt. during this time, processor operation halts. to enable fast on/off switching of the pll1 circuit, the pll standby function is provided. this function is controlled by software using the frequency control register. the use of the pll standby function is described below. 9.6.2 usage from off to on : 1. initially, pstby = 0, pllen = 0, and pll circuit 1 is stopped. the output of pll circuit 2 is used for divider 1 input. 2. when the multiplication rate of pll circuit 1 is set in the stc1?tc0 bits and pstby is set to 1, pll circuit 1 begins oscillating at the specified multiplication rate. the input to divider 1 is still the output of pll circuit 2 at this point. 3. after pll circuit 1 oscillation has stabilized, the input of divider 1 switches when pllen is set to 1 and the oscillation output of pll circuit 1 is divided and becomes the internal clock. at this time, the division ratio can be changed by changing the settings of ifc1?fc0 and pfc1?fc0. for several cycles before and after the clock switches, the internal clock will be stopped, but the peripheral clock and ckio output do not stop. from on to off : 1. when pllen is set to 0, the input of divider 1 switches to the output of pll circuit 2. at this time, the division ratio can be changed by changing the settings of ifc1?fc0 and pfc1 pfc0. 2. when pstby is set to 0, pll circuit 1 stops. this setting can be performed simultaneously (and with the same instruction as) the setting in 1 above. notes: 1. there are some restrictions on the pll standby state (pstby = 1, pllen = 0) as follows: the settings of the frequency control register? ckoen, stc2?tc0, ifc2?fc0 and pfc2?fc0 bits generally cannot be changed. in some cases, however, they can be changed if the pstby and pllen bit settings are also changed simultaneously (figure 9.3). the sleep instruction cannot be executed. 2. it is the responsibility of software to ensure the oscillation settling time. if pllen is set to 1 before the oscillation has settled, malfunctions may be caused by an unstable clock.
176 3. in clock modes 3 and 4, the sh7708 series cannot go to standby mode while pll circuit 1 is on. always set pstby and pllen to 0 to stop pll circuit 1 before going to standby mode. 4. when pstby and pllen are both changed from 0 to 1 together, the wdt will automatically start counting and the clock will switch when the wdt overflows. see section 9.5, changing the frequency, for setting the wdt. pll1 off pll1 standby pstby = 1 (stc) pstby = 0 (stc) pll1 on pllen = 1 (ifc, pfc) pstby = 1 and pllen = 1 pstby = 0, pllen = 0 (stc, ifc, pfc) pstby = 0 and pllen = 0 pstby = 1 and pllen = 0 pllen = 0 (stc, ifc, pfc) note: bits in parentheses can be changed simultaneously. figure 9.3 state transitions for the pll standby function 9 . 7 controlling clock output the ckoen bit in the frqcr register can be used to switch between outputting a clock to the ckio pin or having the level fixed. 9.7.1 clock modes 0? the ckio pin level cannot be fixed. always set the ckoen bit in frqcr to 1 (clock output). 9.7.2 clock modes 3 and 4 the ckio output changes as soon as the ckoen bit is changed. when the wdt is started by simultaneously changing the multiplication rate of pll circuit 1 or switching pll circuit 1 on or off, the wdt starts running after the ckio output is switched, and then the internal clock changes.
177 9 . 8 overview of the watchdog timer (wdt) 9.8.1 block diagram of the wdt figure 9.4 shows a block diagram of the wdt. wtcsr standby control bus interface wtcnt divider clock selector clock internal bus standby mode peripheral clock standby cancellation reset control clock selection wdt overflow internal reset request interrupt control interrupt request wtcsr: wtcnt: watchdog timer control/status register watchdog timer counter figure 9.4 block diagram of the wdt 9.8.2 register configurations the wdt has two registers that select the clock, switch the timer mode, and perform other functions. table 9.5 shows the wdt register.
178 table 9.5 register configuration name abbreviatio n r/w size initial value address watchdog timer counter wtcnt r/w* r: byte; w: word* h'00 h'ffffff84 watchdog timer control/status register wtcsr r/w* r: byte; w: word* h'00 h'ffffff86 note: write with a word access. write h'5a and h'a5, respectively, in the upper bytes. byte or longword writes are not possible. read with a byte access. 9 . 9 wdt registers 9.9.1 watchdog timer counter (wtcnt) the watchdog timer counter (wtcnt) is an 8-bit read/write counter that increments on the selected clock. when an overflow occurs, it generates a reset in watchdog timer mode and an interrupt in interval time mode. its address is h'ffffff84. the wtcnt counter is initialized to h'00 only by a power-on reset through the reset pin. use a word access to write to the wtcnt counter, with h'5a in the upper byte. use a byte access to read wtcnt. bit: 7 6 5 4 3 2 1 0 initial value: 0 0 0 0 0 0 0 0 r/w: r/w r/w r/w r/w r/w r/w r/w r/w 9.9.2 watchdog timer control/status register (wtcsr) the watchdog timer control/status register (wtcsr) is an 8-bit read/write register composed of bits to select the clock used for the count, bits to select the timer mode, and overflow flags. its address is h'ffffff86. the wtcsr register is initialized to h'00 only by a power-on reset through the reset pin. when a wdt overflow causes an internal reset, the wtcsr retains its value. when used to count the clock settling time for canceling a standby, it retains its value after counter overflow. use a word access to write to the wtcsr counter, with h'a5 in the upper byte. use a byte access to read wtcsr. bit: 7 6 5 4 3 2 1 0 tme wt/ it rsts wovf iovf cks2 cks1 cks0 initial value: 0 0 0 0 0 0 0 0 r/w: r/w r/w r/w r/w r/w r/w r/w r/w
179 bit 7?imer enable (tme): starts and stops timer operation. clear this bit to 0 when using the wdt in standby mode or when changing the clock frequency. bit 7: tme description 0 timer disabled: count-up stops and wtcnt value is retained (initial value) 1 timer enabled bit 6?imer mode select (wt/ it ): selects whether to use the wdt as a watchdog timer or an interval timer. bit 6: wt/ it description 0 use as interval timer(initial value) 1 use as watchdog timer note: if wt/ it is modified when the wdt is running, the up-count may not be performed correctly. bit 5?eset select (rsts): selects the type of reset when the wtcnt overflows in watchdog timer mode. in interval timer mode, this setting is ignored. bit 5: rsts description 0 power-on reset(initial value) 1 manual reset bit 4?atchdog timer overflow (wovf): indicates that the wtcnt has overflowed in watchdog timer mode. this bit is not set in interval timer mode. bit 4: wovf description 0 no overflow(initial value) 1 wtcnt has overflowed in watchdog timer mode bit 3?nterval timer overflow (iovf): indicates that the wtcnt has overflowed in interval timer mode. this bit is not set in watchdog timer mode. bit 3: iovf description 0 no overflow(initial value) 1 wtcnt has overflowed in interval timer mode bits 2 to 0?lock select 2? (cks2?ks0): these bits select the clock to be used for the wtcnt count from the eight types obtainable by dividing the peripheral clock. the overflow period in the table is the value when the peripheral clock (p f ) is 15 mhz.
180 bit 2: cks2 bit 1: cks1 bit 0: cks0 clock division ratio overflow period (when p f = 15 mhz) 0001 (initial value) 17 m s 1 1/4 68 m s 1 0 1/16 273 m s 1 1/32 546 m s 1 0 0 1/64 1.09 ms 1 1/256 4.36 ms 1 0 1/1024 17.46 ms 1 1/4096 69.84 ms note: if bits cks2?ks0 are modified when the wdt is running, the up-count may not be performed correctly. ensure that these bits are modified only when the wdt is not running. 9.9.3 notes on register access the watchdog timer counter (wtcnt) and watchdog timer control/status register (wtcsr) are more difficult to write to than other registers. the procedure for writing to these registers are given below. writing to wtcnt and wtcsr: these registers must be written by a word transfer instruction. they cannot be written by a byte or longword transfer instruction. when writing to wtcnt, set the upper byte to h'5a and transfer the lower byte as the write data, as shown in figure 9.5. when writing to wtcsr, set the upper byte to h'a5 and transfer the lower byte as the write data. this transfer procedure writes the lower byte data to wtcnt or wtcsr. 15 8 7 0 h'5a write data address: h'fffffe84 wtcnt write 15 8 7 0 h'a5 write data address: h'fffffe86 wtcsr write figure 9.5 writing to wtcnt and wtcsr
181 9.10 using the wdt 9.10.1 canceling standbys the wdt can be used to cancel standby mode with an nmi or other interrupts. the procedure is described below. (the wdt does not run when resets are used for canceling, so keep the reset pin low until the clock stabilizes.) 1. before transitioning to standby mode, always clear the tme bit in wtcsr to 0. when the tme bit is 1, an erroneous reset or interval timer interrupt may be generated when the count overflows. 2. set the type of count clock used in the cks2?ks0 bits in wtcsr and the initial values for the counter in the wtcnt counter. these values should ensure that the time till count overflow is longer than the clock oscillation settling time. 3. move to standby mode by executing a sleep instruction to stop the clock. 4. the wdt starts counting by detecting the edge change of the nmi signal or detecting interrupts. 5. when the wdt count overflows, the cpg starts supplying the clock and the processor resumes operation. the wovf flag in wtcsr is not set when this happens. 6. the counter stops at the values h'00?'01. the stop value depends on the clock ratio. 9.10.2 changing the frequency to change the frequency used by the pll, use the wdt. when changing the frequency only by switching the divider, do not use the wdt. 1. before changing the frequency, always clear the tme bit in wtcsr to 0. when the tme bit is 1, an erroneous reset or interval timer interrupt may be generated when the count overflows. 2. set the type of count clock used in the cks2?ks0 bits of wtcsr and the initial values for the counter in the wtcnt counter. these values should ensure that the time till count overflow is longer than the clock oscillation settling time. 3. when the frequency control register (frqcr) is written, the clock stops and the processor enters standby mode temporarily. the wdt starts counting. 4. when the wdt count overflows, the cpg resumes supplying the clock and the processor resumes operation. the wovf flag in wtcsr is not set when this happens. 5. the counter stops at the values h'00?'01. the stop value depends on the clock ratio.
182 9.10.3 using watchdog timer mode 1. set the wt/ it bit in the wtcsr register to 1, set the reset type in the rsts bit, set the type of count clock in the cks2?ks0 bits, and set the initial value of the counter in the wtcnt counter. 2. set the tme bit in wtcsr to 1 to start the count in watchdog timer mode. 3. while operating in watchdog timer mode, rewrite the counter periodically to h'00 to prevent the counter from overflowing. 4. when the counter overflows, the wdt sets the wovf flag in wtcsr to 1 and generates the type of reset specified by the rsts bit. the counter then resumes counting. 9.10.4 using interval timer mode when operating in interval timer mode, interval timer interrupts are generated at every overflow of the counter. this enables interrupts to be generated at set periods. 1. clear the wt/ it bit in the wtcsr register to 0, set the type of count clock in the cks2 cks0 bits, and set the initial value of the counter in the wtcnt counter. 2. set the tme bit in wtcsr to 1 to start the count in interval timer mode. 3. when the counter overflows, the wdt sets the iovf flag in wtcsr to 1 and an interval timer interrupt request is sent to intc. the counter then resumes counting.
183 9.10.5 usage notes wtcnt should be set as shown below when using the sh7708 wdt in watchdog timer mode or interval timer mode. (a) (b) no yes wtcnt setting wtcnt = set value + 1? sleep instruction wtcnt setting sleep instruction wait for 2 wdt count clock cycles perform either processing (a) or processing (b). no processing is required when the wdt is not used (wtcsr.tme = 0). if this processing is not performed, the wdt count will stop in sleep mode. (a) read wtcnt and confirm that it has been incremented, then execute a sleep instruction. (b) wait for two wdt count clock cycles after wtcnt is set, then execute a sleep instruction. figure 9.6 to operate the wdt in sleep mode (a) (b) no yes wtcnt setting wtcnt = set value + 1? wtnct instruction wtcnt setting wtcnt instruction wait for 2 wdt count clock cycles perform either processing (a) or processing (b). no processing is required when the wdt is not used (wtcsr.tme = 0). if this processing is not performed, the second wtcnt setting may not be carried out. (a) after the first wtcnt setting, read wtcnt and confirm that it has been incremented, then perform the next wtcnt setting. (b) after the first wtcnt setting, wait for two wdt count clock figure 9.7 to perform repeated wtcnt settings
184 9.11 notes on board design when using an external crystal resonator: place the crystal resonator, capacitors cl1 and cl2, and damping resistor r close to the extal and xtal pins. to prevent induction from interfering with correct oscillation, use a common grounding point for the capacitors connected to the resonator, and do not locate a wiring pattern near these components. note: the values for cl1, cl2, and the damping resistance should be determined after consultation with the crystal manufacturer. xtal extal sh7708r r cl2 cl1 avoid crossing signal lines figure 9.8 points for attention when using crystal resonator decoupling capacitors: as far as possible, insert a laminated ceramic capacitor of 0.01 to 0.1 m f as a passive capacitor for each v ss /v cc pair. mount the passive capacitors as close as possible to the lsi power supply pins, and use components with a frequency characteristic suitable for the lsi operating frequency, as well as a suitable capacitance value. digital system v ss /v cc pairs: 6-7, 17-18, 19-20, 30-31, 41-42, 49-50, 54-55, 59-60, 68-69, 82-81,83, 100-102, 115-116, 121-122, 127-128, 144-139 on-chip oscillator v ss /v cc pairs: 73-75, 76-78, 138-135 when using a pll oscillator circuit: keep the wiring from the pll v cc and v ss connection pattern to the power supply pins short, and make the pattern width large, to minimize the inductance component. ground the oscillation stabilization capacitors c1 and c2 to v ss (pll1) and v ss (pll2), respectively. place c1 and c2 close to the cap1 and cap2 pins and do not locate a wiring pattern in the vicinity. in clock mode 7, connect the extal pin to v cc or v ss and leave the xtal pin open.
185 cap2 v cc (pll2) v cc (pll1) v cc c1 = 470 pf c2 = 470 pf v ss cap1 v ss (pll2) v ss (pll1) avoid crossing signal lines power supply reference values c2 c1 figure 9.9 points for attention when using pll oscillator circuit
186
187 section 10 bus state controller (bsc) 10.1 overview the bus state controller (bsc) divides physical address space and outputs control signals for various types of memory and bus interface specifications. bsc functions enable the sh7708 series to link directly with dram, synchronous dram, pseudo-sram, sram, rom, and other memory storage devices without an external circuit. the bsc also allows direct connection to pcmcia interfaces, simplifying system design and allowing high-speed data transfers in a compact system. 10.1.1 features the bsc has the following features: physical address space is divided into seven areas ? a maximum 64 mbytes for each of the seven areas, 0? ? area bus width can be selected by register (area 0 is set by external pin) ? wait states can be inserted using the wait pin ? wait state insertion can be controlled through software. register settings can be used to specify the insertion of 1?0 cycles independently for each area (areas 1 and 2 have a common setting) ? the type of memory connected can be specified for each area, and control signals are output for direct memory connection ? wait cycles are automatically inserted to avoid data bus conflict for continuous memory accesses to different areas or writes directly following reads of the same area direct interface to dram ? multiplexes row/column addresses according to dram capacity ? supports burst operation (high-speed page mode, hyper page mode) ? supports cas-before-ras refresh and self-refresh ? performs low power 4-cas-system byte control ? controls timing of dram direct-connection control signals according to register settings direct interface to synchronous dram ? multiplexes row/column addresses according to synchronous dram capacity ? supports burst operation ? has both auto-refresh and self-refresh functions ? controls timing of synchronous dram direct-connection control signals according to register setting
188 direct interface to pseudo-sram ? supports burst operation (static column mode) ? auto-refresh and self-refresh rom burst interface ? insertion of wait states controllable through software ? register setting control of burst transfers pcmcia direct-connection interface ? insertion of wait states controllable through software ? burst operation (page mode) ? bus sizing function for i/o bus width (little-endian mode only) fine refreshing control ? supports refresh operation immediately after self-refresh operation in low-power dram by means of refresh counter overflow interrupt function refresh counter can be used as an interval timer ? interrupt request generated at compare-match ? interrupt request generated at refresh counter overflow 10.1.2 block diagram figure 10.1 shows a block diagram of the bus state controller.
189 wcr1 wcr2 bcr1 module bus bcr2 mcr dcr bsc rfcr rtcnt comparator refresh controller peripheral bus internal bus interrupt controller memory controller area controller wait controller wait cs6 cs0 , ce2a , ce2b bs rd rd/ wr we3 we0 ras cas , casxx cke iciord , iciowr iois16 bus interface rtcsr rtcor pcr wcr: wait state control register rfcr: refresh count register bcr: bus control register rtcnt: refresh timer count register mcr: memory control register rtcor: refresh time constant register dcr: dram control register rtcsr: refresh timer control/status register pcr: pcmcia control register figure 10.1 bsc block diagram
190 10.1.3 pin configuration table 10.1 lists the bsc pins. table 10.1pin configuration pin name signal i / o description address bus a25?0 o address output data bus d31?24, d15?0 i/o data i/o when port function is used, d31?24 cannot be used. leave these pins open. data bus/port d23?16/ port7?ort0 i/o when port function is not used, data i/o; when port function is used, port (i/o is set by register for each bit) bus cycle start bs o shows start of bus cycle. during burst transfers, asserts every data cycle. chip select 6? cs6 cs0 o chip select signal to indicate area being accessed. cs5 and cs6 can also be used as ce1a and ce1b of pcmcia. read/write rd/ wr o data bus direction indicator signal. dram/synchronous dram/pcmcia write indicator signal. row address strobe ras / ce o when dram/synchronous dram is used, ras signal. when pseudo-sram is used, ce signal. column address strobe cas / casll / oe o when synchronous dram is used, cas signal. when dram is used, cas signal for d7?0. when pseudo-sram is used, oe / rfsh signal. column address strobe lh caslh o when dram is used, cas signal for d15?8 column address strobe hl cashl , cas2l o when dram is used, cas signal for d23?16. when the area 2 dram is being used, cas signal for d7 d0. column address strobe hh cashh , cas2h o when dram is used, cas signal for d31?24. when the area 2 dram is being used, cas signal for d15 d8.
191 table 10.1pin configuration (preliminary) (cont) pin name signal i / o description data enable 0 dqmll/ we0 o when synchronous dram is used, selects d7?0. for other memory, d7?0 write strobe signal. data enable 1 dqmlu/ we1 o when synchronous dram is used, selects d15?8. when pcmcia is used, strobe signal that indicates the write cycle. for other memory, d15?8 write strobe signal. data enable 2 dqmul/ we2 / iciord o when synchronous dram is used, selects d23 d16. for other memory, d23?16 write strobe signal. for pcmcia, strobe signal indicating i/o read. data enable 3 dqmuu/ we3 / iciowr o when synchronous dram is used, selects d31 d24. for other memory, d31?24 write strobe signal. for pcmcia, strobe signal indicating i/o write. read rd o strobe signal indicating read cycle wait wait i wait state request signal (synchronous signal) 16-bit i/o iois16 i signal indicating pcmcia 16-bit i/o. valid only in little-endian mode. (fix low in big-endian mode.) clock enable cke o connected to clock enable control signal of synchronous dram bus release request breq i bus release request signal bus release acknowledgment back o bus release acknowledge signal area 0 bus width, pcmcia card select md3/ ce2a * 1 , md4/ ce2b * 2 i/o signal controlling bus width of physical space area 0. when pcmcia is used, ce2a and ce2b . endian switching/ low address strobe md5/ ras2 * 3 i/o signal setting endian for all spaces on reset. when area 2 dram is connected, area 2 dram ras signal notes: 1. md3/ ce2a input/output switching is performed by bcr1.a5pcm. output is selected when bcr1.a5pcm = 1. 2. md4/ ce2b input/output switching is performed by bcr1.a6pcm. output is selected when bcr1.a6pcm = 1. 3. md5/ ras2 input/output switching is performed by bcr1.dramtp. output is selected when bcr1.dramtp (2?) = 101.
192 10.1.4 register configuration the bsc has 11 registers (table 10.2). the synchronous dram also has a built-in synchronous dram mode register. these registers control direct connection interfaces to memory, wait states, refreshes, and pcmcia devices. table 10.2register configuration name abbr. r/w initial value* 2 address bus width bus control register 1 bcr1 r/w h'0000 h'ffffff60 16 bus control register 2 bcr2 r/w h'3ffc h'ffffff62 16 wait state control register 1 wcr1 r/w h'3fff h'ffffff64 16 wait state control register 2 wcr2 r/w h'ffff h'ffffff66 16 individual memory control register mcr r/w h'0000 h'ffffff68 16 dram control register dcr r/w h'0000 h'ffffff6a 16 pcmcia control register pcr r/w h'0000 h'ffffff6c 16 refresh timer control/status register rtcsr r/w h'0000 h'ffffff6e 16 refresh timer counter rtcnt r/w h'0000 h'ffffff70 16 refresh time constant register rtcor r/w h'0000 h'ffffff72 16 refresh count register rfcr r/w h'0000 h'ffffff74 16 sdram mode register, area 2 sdmr w h'ffffd000 h'ffffdfff 8 sdram mode register, area 3 h'ffffe000 h'ffffefff notes: 1. for details see section 10.2.8, synchronous dram mode register. 2. initialized during a power-on reset.
193 10.1.5 area overview space allocation: the sh7708 series architecture provides for a 32-bit virtual address space. the virtual space is divided into five areas by the value of the upper bits of the address. the physical space is divided into eight areas with a 29-bit address space. virtual space can be allocated at will to physical spaces using a memory management unit (mmu). for details, refer to section 3, memory management unit, which describes area allocation for physical spaces. as shown in table 10.4, the sh7708 series can be connected directly to seven areas of memory/pc card, and it outputs chip select signals ( cs0 cs6 , ce2a , ce2b ) for each of them. cs0 is asserted during area 0 access; cs6 is asserted during area 6 access. when dram, synchronous dram, or pseudo-sram is connected to area 2 or 3, signals such as ras , cas , rd/ wr , and dqm are also asserted. when pcmcia interface is selected in area 5 or 6, in addition to cs5 / cs6 , ce2a / ce2b are asserted for the corresponding bytes accessed. for virtual address spaces p0 and p3, when the memory management unit (mmu) is on, any physical address can be generated by the mmu for a virtual address. consequently, figure 10.2 can be applied when the mmu is off, and when the mmu is on and the physical addresses corresponding to virtual addresses are identical except for the top 3 bits. when virtual addresses are translated to arbitrary physical addresses, refer to table 10.3, physical address space map. area 0 ( cs0 ) area 1 ( cs1) area 2 ( cs2 ) area 3 ( cs3 ) area 4 ( cs4 ) area 5 ( cs5 ) area 6 ( cs6 ) h'00000000 h'20000000 h'40000000 h'60000000 h'80000000 h'a0000000 h'c0000000 h'e0000000 h'00000000 h'04000000 h'08000000 h'0c000000 h'10000000 h'14000000 h'18000000 reserved area physical address space virtual address space p0, u0 p1 p2 p3 p4 figure 10.2 correspondence between virtual address space and physical address space
194 table 10.3 physical address space map area physical address connectable memory capacity access size 0 h'00000000 to h'03ffffff normal memory *1 , burst 64 mbytes 8, 16, 32 *2 h'00000000 + h'20000000 n to h'03ffffff + h'20000000 n rom shadow n: 16 1 h'04000000 to h'07ffffff normal memory 64 mbytes 8, 16, 32 *3 h'04000000 + h'20000000 n to h'07ffffff + h'20000000 n shadow n: 16 2 h'08000000 to h'0bffffff normal memory, 64 mbytes 8, 16, 32 *3, *4 h'08000000 + h'20000000 n to h'0bffffff + h'20000000 n synchronous dram, dram shadow n: 16 3 h'0c000000 to h'0fffffff normal memory, 64 mbytes 8, 16, 32 *3, *5 h'0c000000 + h'20000000 n to h'0fffffff + h'20000000 n synchronous dram, dram, pseudo-sram shadow n: 16 4 h'10000000 to h'13ffffff normal memory 64 mbytes 8, 16, 32 *3 h'10000000 + h'20000000 n to h'13ffffff + h'20000000 n shadow n: 16 5 *5 h'14000000 to h'15ffffff normal memory, pcmcia, 32 mbytes 8, 16, 32 *3, *6 h'16000000 to h'17ffffff burst rom 32 mbytes h'14000000 + h'20000000 n to h'17ffffff + h'20000000 n shadow n: 16 6 h'18000000 to h'19ffffff normal memory, pcmcia, 32 mbytes 8, 16, 32 *3, *6 h'1a000000 to h'1bffffff burst rom h'18000000 + h'20000000 n to h'1bffffff + h'20000000 n shadow n: 16 7 *7 h'1c000000 + h'20000000 n to h'1fffffff + h'20000000 n reserved area n: 0? notes: 1. memory with an sram, rom, or similar interface 2. memory bus width specified by external pin 3. memory bus width specified by register 4. with synchronous dram interface, bus width is 32 bits only. with dram interface, bus width is 16 bits only. 5. with synchronous dram interface, bus width is 32 bits only. with dram and pseudo-sram interface, bus width is either 16 or 32 bits only. when areas 2 and 3 are both dram interface areas, bus width is 16 bits only. 6. with pcmcia interface, bus width is either 8 or 16 bits only. 7. do not access a reserved area, as operation cannot be guaranteed in this case.
195 area 0: h'00000000 area 1: h'04000000 area 2: h'08000000 area 3: h'0c000000 area 4: h'10000000 area 5: h'14000000 the pcmcia interface is for the memory card only only dram with a 16-bit bus can be connected to area 2 the pcmcia interface is shared by the memory and i/o card area 6: h'18000000 normal memory/ burst rom normal memory normal memory/ synchronous dram, dram normal memory/synchronous dram, dram, pseudo-sram normal memory normal memory/ burst rom/pcmcia normal memory/ burst rom/pcmcia figure 10.3 physical space allocation memory size: the memory size in the sh7708series can be set for each area. in area 0, an external pin can be used to select byte (8 bits), word (16 bits), or longword (32 bits). the relationship between the external pins (md4 and md3) and the bus width after a power-on reset is as follows. md4 md3 bus width 0 0 reserved (do not set) 1 8 bits 1 0 16 bits 1 32 bits for areas 1?, byte, word, and longword may be chosen for the bus width using bus control register 2 (bcr2) whenever normal memory, rom, burst rom, or the pcmcia interface is used. when the dram or pseudo-sram interfaces are used, word or longword can be chosen as the bus width using the individual memory control register (mcr). set the bus width to longword with mcr for synchronous dram interfaces. when area 2 is used as a dram area, set the bus widths of areas 2 and 3 to word. when areas 5 and 6 are used as pcmcia interfaces, set the bus width to byte or word. when using the port function, set each of the bus widths to byte or word for all areas. for more information, see section 10.2.2, bus control register 2 (bcr2), and section 10.2.5, individual memory control register (mcr).
196 shadow space: areas 0? are decoded by physical address bits a28?26, which correspond to areas 000 to 110. address bits 31?9 are ignored. this means that the range of area 0 addresses, for example, is h'00000000 to h'03ffffff, and its corresponding shadow space is the address space obtained by adding to it h'20000000 n (n = 1?). the address range for area 7, which is on-chip i/o space, is h'fc000000 to h'fffffff. the address space h'1c000000 + h'20000000 n h'1fffffff + h'20000000 n (n = 0?) corresponding to the area 7 shadow space is reserved, so should not be used. 10.1.6 pcmcia support the sh7708 series supports pcmcia standard interface specifications in physical space areas 5 and 6. the interface supported is basically the ic memory card interface and i/o card interface defined by pcmcia specifications version 4.2. in addition, burst access is supported to enable high-speed access. physical space area 5 supports the ic memory card interface only; area 6 supports both the ic memory card interface and the i/o card interface. table 10.4pcmcia interface characteristics item characteristics access random access + burst access (rom page mode correspondence added) data bus 8/16 bits memory type mask rom, otprom, eprom, eeprom, flash memory, sram memory capacity maximum 32 mbytes i/o section capacity maximum 32 mbytes other supports dynamic i/o bus sizing* and access to pcmcia interface from both the address translation area and non-address translation area note: dynamic i/o bus sizing is supported only in little-endian mode. common memory/attribute memory area 5: h'14000000 area 5: h'16000000 common memory/attribute memory area 6: h'18000000 i/o space area 6: h'1a000000 figure 10.4 pcmcia space allocation
197 table 10.5 pcmcia support interface ic memory card interface i/o card interface sh7708 series pin signal i / o function signal i / o function pin 1 gnd ground gnd ground 2 d3 i/o data d3 i/o data d3 3 d4 i/o data d4 i/o data d4 4 d5 i/o data d5 i/o data d5 5 d6 i/o data d6 i/o data d6 6 d7 i/o data d7 i/o data d7 7 ce1 i card enable ce1 i card enable cs5 or cs6 8 a10 i address a10 i address a10 9 oe i output enable oe i output enable rd 10 a11 i address a11 i address a11 11 a9 i address a9 i address a9 12 a8 i address a8 i address a8 13 a13 i address a13 i address a13 14 a14 i address a14 i address a14 15 we / pgm i write enable we / pgm i write enable we1 16 rdy/ bsy o ready/busy ireq o interrupt request sensed at port 17 v cc operation power v cc operation power 18 vpp1 program power vpp1 program/ peripheral power 19 a16 i address a16 i address a16 20 a15 i address a15 i address a15 21 a12 i address a12 i address a12 22 a7 i address a7 i address a7 23 a6 i address a6 i address a6 24 a5 i address a5 i address a5 25 a4 i address a4 i address a4 26 a3 i address a3 i address a3 27 a2 i address a2 i address a2 28 a1 i address a1 i address a1 29 a0 i address a0 i address a0 30 d0 i/o data d0 i/o data d0
198
199 table 10.5 pcmcia support interface (cont) ic memory card interface i/o card interface sh7708 series pin signal i / o function signal i / o function pin 31 d1 i/o data d1 i/o data d1 32 d2 i/o data d2 i/o data d2 33 wp* o write protect iois16 o 16 bit i/o port iois16 34 gnd ground gnd ground 35 gnd ground gnd ground 36 cd1 o card detection cd1 o card detection sensed at port 37 d11 i/o data d11 i/o data d11 38 d12 i/o data d12 i/o data d12 39 d13 i/o data d13 i/o data d13 40 d14 i/o data d14 i/o data d14 41 d15 i/o data d15 i/o data d15 42 ce2 i card enable ce2 i card enable ce2a or ce2b 43 rfsh i refresh request rfsh i refresh request output from port 44 rfu reserved iord i i/o read iciord 45 rfu reserved iowr i i/o write iciowr 46 a17 i address a17 i address a17 47 a18 i address a18 i address a18 48 a19 i address a19 i address a19 49 a20 i address a20 i address a20 50 a21 i address a21 i address a21 51 v cc power supply v cc power supply 52 vpp2 program power vpp2 program/ peripheral power 53 a22 i address a22 i address a22 54 a23 i address a23 i address a23 55 a24 i address a24 i address a24 56 a25 i address a25 i address output from port 57 rfu reserved rfu reserved 58 reset i reset reset i reset output from port
200 table 10.5 pcmcia support interface (cont) ic memory card interface i/o card interface sh7708 series pin signal i / o function signal i / o function pin 59 wait o wait request wait o wait request wait 60 rfu reserved inpack o input acknowledge 61 reg i attribute memory space select reg i attribute memory space select output from port 62 bvd2 o battery voltage detection spkr o digital voice signal sensed at port 63 bvd1 o battery voltage detection stschg o card status change sensed at port 64 d8 i/o data d8 i/o data d8 65 d9 i/o data d9 i/o data d9 66 d10 i/o data d10 i/o data d10 67 cd2 o card detection cd2 o card detection sensed at port 68 gnd ground gnd ground note: the sh7708 series does not provide wp support.
201 10.2 bsc registers 10.2.1 bus control register 1 (bcr1) the bus control register 1 (bcr1) is a 16-bit read/write register that sets the functions and bus cycle status for each area. it is initialized to h'0000 by a power-on reset, but is not initialized by a manual reset or in standby mode. do not access external memory outside area 0 until bcr1 register initialization is complete. bit: 15 14 13 12 11 10 9 8 bit name: hizmem* 2 hizcnt endian a0bst1 a0bst0 a5bst1 initial value: 0 0 0 0 0/1* 1 000 r/w: r r r/w r/w r r/w r/w r/w bit: 7 6 5 4 3 2 1 0 bit name: a5bst0 a6bst1 a6bst0 dram tp2 dram tp1 dram tp0 a5pcm a6pcm initial value: 0 0 0 0 0 0 0 0 r/w: r/w r/w r/w r/w r/w r/w r/w r/w notes: 1. samples the value of the external pin designating endian upon a power-on reset. 2. reserved bit in the sh7708. bits 15 and 14?eserved: these bits always read 0. the write value should always be 0. bits 13 (sh7708)?eserved: these bits always read 0. the write value should always be 0. this bit is not supported in emulator. bit 13 (sh7708s, sh7708r) ?igh-z memory control (hizmem): specifies the state of a25 to a0, bs, cs, rd/wr, we/dqm, rd, md3/ce2a, and md4/ce2b in standby mode. bit 13: hizmem description 0 high-impedance (high-z) in standby mode (initial value) 1 drive state in standby mode bit 12?igh-z control (hizcnt): specifies the state of the ras and cas signals in the standby and bus-released states.
202 bit 12: hizcnt description 0 ras and cas signals become high-impedance (high-z) in standby mode and in bus-released state. (initial value) 1 ras and cas signals drive in standby mode and in bus-released state. bit 11?ndian flag (endian): samples the value of the external pin designating endian upon a power-on reset. endian for all physical spaces is decided by this bit, which is read-only. bit 11: endian description 0 (on reset) endian setting external pin (md5) is low. indicates the sh7708 series is set as big-endian. 1 (on reset) endian setting external pin (md5) is high. indicates the sh7708 series is set as little-endian. bits 10 and 9?rea 0 burst rom control (a0bst1?0bst0): these bits specify whether to use burst rom in physical space area 0. when burst rom is used, they set the number of burst transfers. bit 10: a0bst1 bit 9: a0bst0 description 0 0 access area 0 as normal memory. (initial value) 1 access area 0 as burst rom (4 consecutive accesses). can be used when bus width is 8, 16, or 32. 1 0 access area 0 as burst rom (8 consecutive accesses). can be used only when bus width is 8 or 16. 1 access area 0 as burst rom (16 consecutive accesses). can be used only when bus width is 8. bits 8 and 7?rea 5 burst enable (a5bst1?5bst0): these bits specify whether to use burst rom and pcmcia burst mode in physical space area 5. when burst rom and pcmcia burst mode are used, they set the number of burst transfers.
203 bit 8: a5bst1 bit 7: a5bst0 description 0 0 access area 5 as normal memory. (initial value) 1 burst access of area 5 (4 consecutive accesses). can be used when bus width is 8, 16, or 32. 1 0 burst access of area 5 (8 consecutive accesses). can be used only when bus width is 8 or 16. 1 burst access of area 5 (16 consecutive accesses). can be used only when bus width is 8. bits 6 and 5?rea 6 burst enable (a6bst1?6bst0): these bits specify whether to use burst rom and pcmcia burst mode in physical space area 6. when burst rom and pcmcia burst mode are used, they set the number of burst transfers. bit 6: a6bst1 bit 5: a6bst0 description 0 0 access area 6 as normal memory. (initial value) 1 burst access of area 6 (4 consecutive accesses). can be used when bus width is 8, 16, or 32. 1 0 burst access of area 6 (8 consecutive accesses). can be used only when bus width is 8 or 16. 1 burst access of area 6 (16 consecutive accesses). can be used only when bus width is 8.
204 bits 4 to 2?rea 2, area 3 memory type (dramtp2, dramtp1, dramtp0): these bits designate the types of memory connected to physical space areas 2 and 3. normal memory, such as rom, sram, or flash ram, can be directly connected. pseudo-sram, dram, and synchronous dram can also be directly connected. bit 4: dramtp2 bit 3: dramtp1 bit 2: dramtp0 description 0 0 0 areas 2 and 3 are normal memory (initial value) 1 area 2: normal memory; area 3: psram 1 0 area 2: normal memory; area 3: sdram 1 areas 2 and 3 are sdram 1 0 0 area 2: normal memory; area 3: dram 1 areas 2 and 3 are dram * 1 0 reserved (cannot be set) 1 reserved (cannot be set) note: when selecting these bits, set the area 2 and 3 bus widths as word. the md5 pin output is the ras2 signal. bit 1?rea 5 bus type (a5pcm): designates whether to access physical space area 5 as pcmcia space. bit 1: a5pcm description 0 access physical space area 5 as normal memory. (initial value) 1 access physical space area 5 as pcmcia space.* note: md3 pin output is ce2a . bit 0?rea 6 bus type (a6pcm): designates whether to access physical space area 6 as pcmcia space. bit 0: a6pcm description 0 access physical space area 6 as normal memory. (initial value) 1 access physical space area 6 as pcmcia space.* note: md4 pin output is ce2b . 10.2.2 bus control register 2 (bcr2) bus control register 2 (bcr2) is a 16-bit read/write register that selects the bus size of each area, and whether to use the 8-bit port. it is initialized to h'3ffc by a power-on reset, but is not
205 initialized by a manual reset or in standby mode. do not access external memory outside area 0 until bcr2 register initialization is complete. bit: 15 14 13 12 11 10 9 8 bit name: a6sz1 a6sz0 a5sz1 a5sz0 a4sz1 a4sz0 initial value: 0 0 1 1 1 1 1 1 r/w: r r r/w r/w r/w r/w r/w r/w bit: 7 6 5 4 3 2 1 0 bit name: a3sz1 a3sz0 a2sz1 a2sz0 a1sz1 a1sz0 porten initial value: 1 1 1 1 1 1 0 0 r/w: r/w r/w r/w r/w r/w r/w r/w bits 15, 14, 1?eserved: these bits always read 0. the write value should always be 0. bits 2n + 1, 2n?rea n (1?) bus size specification (ansz1, ansz0): these bits specify the bus sizes of physical space area n (n = 1 to 6). bit 2n + 1: ansz1 bit 2n: ansz0 bit 0: porten description 0 0 0 reserved (not settable) 1 byte (8-bit) size 1 0 word (16-bit) size 1 longword (32-bit) size (initial value) 0 0 1 reserved (not settable) 1 byte (8-bit) size 1 0 word (16-bit) size 1 reserved (not settable) bit 0?ort function enable (porten): designates whether to use the d23?16 pins as an 8-bit port. when using this function set the bus widths to word or byte in all areas. bit 0: porten description 0 d23?16 are not used as a port. (initial value) 1 d23?16 are used as a port. 10.2.3 wait state control register 1 (wcr1)
206 wait state control register 1 (wcr1) is a 16-bit read/write register that specifies the number of idle (wait) state cycles inserted for each area. for some memories, the drive of the data bus may not be turned off quickly even when the read signal from the external device is turned off. this can result in conflicts between data buses when consecutive memory accesses are to different memories or when a write immediately follows a memory read. the sh7708 series automatically inserts idle states equal to the number set in wcr1 in those cases. wcr1 is initialized to h'3fff by a power-on reset. it is not initialized by a manual reset or in standby mode, but retains its contents. bit: 15 14 13 12 11 10 9 8 bit name: a6iw1 a6iw0 a5iw1 a5iw0 a4iw1 a4iw0 initial value: 0 0 1 1 1 1 1 1 r/w: r r r/w r/w r/w r/w r/w r/w bit: 7 6 5 4 3 2 1 0 bit name: a3iw1 a3iw0 a2iw1 a2iw0 a1iw1 a1iw0 a0iw1 a0iw0 initial value: 1 1 1 1 1 1 1 1 r/w: r/w r/w r/w r/w r/w r/w r/w r/w bits 15, 14 ?eserved: these bits always read 0. the write value should always be 0. bits 2n + 1, 2n?rea n (6?) intercycle idle specification (aniw1, aniw0): these bits specify the number of idles inserted between bus cycles when switching between physical space area n (6 0) to another space or between a read access to a write access in the same physical space. bit 2n + 1: aniw1 bit 2n: aniw0 description 0 0 no idle cycles 1 1 idle cycle inserted 1 0 2 idle cycles inserted 1 3 idle cycles inserted (initial value)
207 10.2.4 wait state control register 2 (wcr2) wait state control register 2 (wcr2) is a 16-bit read/write register that specifies the number of wait state cycles inserted for each area. it also specifies the pitch of data access for burst memory accesses. this allows direct connection of even low-speed memories without an external circuit. wcr2 is initialized to h'ffff by a power-on reset. it is not initialized by a manual reset or in standby mode, but retains its contents. bit: 15 14 13 12 11 10 9 8 bit name: a6w2 a6w1 a6w0 a5w2 a5w1 a5w0 a4w2 a4w1 initial value: 1 1 1 1 1 1 1 1 r/w: r/w r/w r/w r/w r/w r/w r/w r/w bit: 7 6 5 4 3 2 1 0 bit name: a4w0 a3w1 a3w0 a1-2w1 a1-2w0 a0w2 a0w1 a0w0 initial value: 1 1 1 1 1 1 1 1 r/w: r/w r/w r/w r/w r/w r/w r/w r/w bits 15 to 13?rea 6 wait control (a6w2, a6w1, a6w0): these bits specify the number of wait states inserted in physical space area 6. they also specify the burst pitch for burst transfer. description first cycle burst cycle (excluding first cycle) bit 15: a6w2 bit 14: a6w1 bit 13: a6w0 inserted wait states wait pin number of states per data transfer wait pin 0 0 0 0 ignored 2 enabled 1 1 enabled 2 enabled 1 0 2 enabled 3 enabled 1 3 enabled 4 enabled 1 0 0 4 enabled 4 enabled 1 6 enabled 6 enabled 1 0 8 enabled 8 enabled 1 10 (initial value) enabled 10 enabled
208 bits 12 to 10?rea 5 wait control (a5w2, a5w1, a5w0): these bits specify the number of wait states inserted in physical space area 5. they also specify the burst pitch for burst transfer. description first cycle burst cycle (excluding first cycle) bit 12: a5w2 bit 11: a5w1 bit 10: a5w0 inserted wait states wait pin number of states per data transfer wait pin 0 0 0 0 ignored 2 enabled 1 1 enabled 2 enabled 1 0 2 enabled 3 enabled 1 3 enabled 4 enabled 1 0 0 4 enabled 4 enabled 1 6 enabled 6 enabled 1 0 8 enabled 8 enabled 1 10 (initial value) enabled 10 enabled bits 9 to 7?rea 4 wait control (a4w2, a4w1, a4w0): these bits specify the number of wait states inserted in physical space area 4. description bit 9: a4w2 bit 8: a4w1 bit 7: a4w0 inserted wait states wait pin 0000 ignored 1 1 enabled 1 0 2 enabled 1 3 enabled 1004 enabled 1 6 enabled 1 0 8 enabled 1 10 enabled (initial value)
209 bits 6 and 5?rea 3 wait control (a3w1, a3w0): these bits specify the number of wait states inserted in physical space area 3. external wait input is enabled only when normal memory is used, and is ignored when dram, synchronous dram, or pseudo-sram is used. for normal memory description bit 6: a3w0 bit 5: a3w0 inserted wait states wait pin 0 0 0 ignored 1 1 enabled 1 0 2 enabled 1 3 enabled (initial value) for dram, sdram, pseudo-sram description bit 6: a3w1 bit 5: a3n0 dram: cas assert period sdram: cas latency psram: oe , we assert period 00 1 1 1 11 1 1 10 2 2 2 1 3 3 3 (initial value) bits 4 and 3?reas 1 and 2 wait control (a1?w1, a1?w0): these bits specify the number of wait states inserted in physical space areas 1 and 2. external wait input is enabled only when normal memory is used, and is ignored when dram or synchronous dram is used.
210 for normal memory description bit 4: a1-2w0 bit 3: a1-2w0 inserted wait states wait pin 0 0 0 ignored 1 1 enabled 1 0 2 enabled 1 3 enabled (initial value) for dram, synchronous dram description bit 4: a1-2w0 bit 3: a1-2w0 dram: cas assert period sdram: cas latency 00 1 1 11 1 10 2 2 1 3 3 (initial value) bits 2 to 0?rea 0 wait control (a0w2, a0w1, a0w0): these bits specify the number of wait states inserted in physical space area 0. they also specify the burst pitch for burst transfer. description first cycle burst cycle (excluding first cycle) bit 2: a0w2 bit 1: a0w1 bit 0: a0w0 inserted wait states wait pin number of states per data transfer wait pin 0 0 0 0 ignored 2 enabled 1 1 enabled 2 enabled 1 0 2 enabled 3 enabled 1 3 enabled 4 enabled 1 0 0 4 enabled 4 enabled 1 6 enabled 6 enabled 1 0 8 enabled 8 enabled 1 10 (initial value) enabled 10 enabled 10.2.5 individual memory control register (mcr) the individual memory control register (mcr) is a 16-bit read/write register that specifies ras and cas timing and burst control for dram (area 3 only), synchronous dram (areas 2 and 3),
211 and pseudo-sram, specifies address multiplexing, and controls refresh. this enables direct connection of dram, synchronous dram and pseudo-sram without external circuits. mcr is initialized to h'0000 by a power-on reset, but is not initialized by a manual reset or in standby mode. bits tpc1?pc0, rcd1?cd0, trwl1?rwl0, tras1?ras0, be, sz, amx1?mx0, and edomode are written to in the initialization after a power-on reset and are not then modified again. when rfsh and rmode are written to, write the same values to the other bits. when using dram, pseudo-sram, and synchronous dram, do not access areas 2 and 3 until this register is initialized. bit: 15 14 13 12 11 10 9 8 bit name: tpc1 tpc0 rcd1 rcd0 trwl1 trwl0 tras1 tras0 00000000 r/w: r/w r/w r/w r/w r/w r/w r/w r/w bit: 7 6 5 4 3 2 1 0 bit name: be sz amx1 amx0 rfsh rmode edo mode initial value: 0 0 0 0 0 0 0 0 r/w: r r/w r/w r/w r/w r/w r/w r/w bits 15 and 14?as precharge time (tpc1, tpc0): when dram interface is selected as connected memory, the tpc bits set the minimum number of cycles until the next ras assertion after ras negation. when synchronous dram interface is selected, they set the minimum number of cycles until output of the next bank-active command after precharge. when pseudo- sram interface is selected, they set the minimum number of cycles until the next ce assertion after ce negation. description bit 15: tpc1 bit 14: tpc0 normally immediately after self- refresh 0 0 1 cycle (initial value) 2 cycles (initial value) 1 2 cycles 5 cycles 1 0 3 cycles 8 cycles 1 4 cycles 11 cycles
212 bits 11 and 10?rite-precharge delay (trwl1, trwl0): these bits set the synchronous dram write-precharge delay time. this designates the time between the end of a write cycle and the next bank-active command. this is valid only when synchronous dram is connected. after the write cycle, the next bank-active command is not issued for the period tpc + trwl. bit 11: trwl1 bit 10: trwl0 description 0 0 1 cycle (initial value) 1 2 cycles 1 0 3 cycles 1 reserved (cannot be set) bits 9 and 8?as-before-ras refresh ras assert time (tras1, tras0): when dram interface is selected as connected memory, the tras bits set the ras assertion period for cas - before- ras refreshes. when pseudo-sram interface is selected, they set the oe / rfsh assertion period for auto-refreshes. when synchronous dram interface is selected, no bank-active command is issued during the period tpc + tras after an auto-refresh command. in the sh7708, set the same values in the tras bits in mcr and dcr. bit 9: tras1 bit 8: tras0 description 0 0 2 cycles (initial value) 1 3 cycles 1 0 4 cycles 1 5 cycles bit 7?eserved: this bit always reads 0. the write value should always be 0. bit 6?urst enable (be): specifies whether to conduct a burst access of dram or pseudo- sram. when accessing synchronous dram, burst access is always carried out, regardless of this bit? designation. bit 6: be description 0 burst disabled (initial value) 1 with dram interface, high-speed page mode access with pseudo-sram interface, continuous data transfer in static column mode
213 bit 5?emory data size (sz): specifies the memory data bus size for dram, synchronous dram, and pseudo-sram. always set this bit to 1 when synchronous dram is used. takes precedence over the bcr2 register designation. bit 5: sz description 0 word (16-bit) (initial value) 1 longword (32-bit) bits 4 and 3?ddress multiplex (amx1, amx0): these bits specify address multiplexing for dram and synchronous dram. the actual address shift value differs between dram interface and synchronous dram interface. for dram interface: bit 4: amx1 bit 3: amx0 description 0 0 8-bit column address product (initial value) 1 9-bit column address product 1 0 10-bit column address product 1 11-bit column address product for synchronous dram interface: bit 4: amx1 bit 3: amx0 description 0 0 16-mbit product (1m 16 bits) (initial value) 1 16-mbit product (2m 8 bits) 1 0 16-mbit product (4m 4 bits) 1 4-mbit product (256k 16 bits) bit 2?efresh control (rfsh): determines whether or not refreshing of dram, synchronous dram, and pseudo-sram is performed. the timer for generation of the refresh request frequency can also be used as an interval timer. bit 2: rfsh description 0 no refresh (initial value) 1 refresh
214 bit 1?efresh mode (rmode): selects whether to perform an ordinary refresh or a self-refresh when the rfsh bit is 1. when the rfsh bit is 1 and this bit is 0, a cas-before-ras refresh or an auto-refresh is performed on dram, synchronous dram or pseudo-sram at the period set by the refresh-related registers rtcnt, rtcor and rtcsr. when a refresh request occurs during an external bus cycle, the bus cycle will be ended and the refresh cycle performed. when the rfsh bit is 1 and this bit is also 1, the dram, synchronous dram or pseudo-sram will wait for the end of any executing external bus cycle before going into a self-refresh. all refresh requests to memory that is in the self-refresh state are ignored. bit 1: rmode description 0 cas-before-ras refresh (rfsh must be 1) (initial value) 1 self-refresh (rfsh must be 1) bit 0?extended data out (edomode): specifies the timing of data sampling during data reads when using dram in edo mode. operating timing of memory other than dram does not change even if this bit is set. this bit is valid only for dram connected to area 3. do not set this bit to 1 when using synchronous dram or pseudo-sram. bit 0: edomode description 0 set when using normal dram. data is sampled during read cycle on the falling edge of ckio. (initial value) 1 set when using edo mode dram. data is sampled during read cycle on the rising edge of ckio. also, ras signal negation is delayed 1/2 a ckio machine cycle.
215 10.2.6 dram control register (dcr) the dram area control register (dcr) is a 16-bit read/write register that specifies ras and cas timing and burst control for dram connected to area 2. it also specifies address multiplexing and controls refreshing. when dram is connected to area 2, the bus width is fixed at 16 bits. in such cases, set the area 3 bus width to 16 bits as well. other areas should be 8 bits or 16 bits. dcr is initialized to h'0000 by a power-on reset, but is not initialized by a manual resets or in standby mode. do not access external memory outside area 2 until initialization of this register is complete. bit: 15 14 13 12 11 10 9 8 bit name: tpc1 tpc0 rcd1 rcd0 tras1 tras0 initial value: 0 0 0 0 0 0 0 0 r/w: r/w r/w r/w r/w r r r/w r/w bit: 7 6 5 4 3 2 1 0 bit name: be amx1 amx0 rfsh rmode initial value: 0 0 0 0 0 0 0 0 r/w: r r/w r r/w r/w r/w r/w r bits 15 and 14?as precharge time (tpc1, tpc0): these bits set the ras precharge time for the dram connected to area 2. description bit 15: tpc1 bit 14: tpc0 normally immediately after self- refresh 0 0 1 cycle (initial value) 2 cycles (initial value) 1 2 cycles 5 cycles 1 0 3 cycles 8 cycles 1 4 cycles 11 cycles
216 bits 13 and 12?as?as delay (rcd1, rcd0): these bits set the ras?as delay time for the dram connected to area 2. bit 13: rcd1 bit 12: rcd0 description 0 0 1 cycle (initial value) 1 2 cycles 1 0 3 cycles 1 4 cycles bits 9 and 8?as-before-ras refresh ras assert time (tras1, tras0): these bits set the ras assert period for cas-before-ras refreshing of the dram connected to area 2. in the sh7708, set the same values in the tras bits in mcr and dcr. bit 9: tras1 bit 8: tras0 description 0 0 2 cycles (initial value) 1 3 cycles 1 0 4 cycles 1 5 cycles bit 6?urst enable (be): specifies whether to conduct a burst access of the dram connected to area 2. bit 6: be description 0 burst disabled (initial value) 1 high-speed page mode access bits 4 and 3?ddress multiplex (amx1, amx0): these bits specify address multiplexing for the dram connected to area 2. bit 4: amx1 bit 3: amx0 description 0 0 8-bit column address product (initial value) 1 9-bit column address product 1 0 10-bit column address product 1 11-bit column address product
217 bit 2?efresh control (rfsh): determines whether or not refreshing of the dram connected to area 2 is performed. bit 2: rfsh description 0 no refresh (initial value) 1 refresh bit 1?efresh mode (rmode): selects the refresh mode for the dram connected to area 2. bit 1: rmode description 0 cas-before-ras refresh (rfsh must be 1) (initial value) 1 self-refresh (rfsh must be 1) 10.2.7 pcmcia control register (pcr) the pcmcia control register (pcr) is a 16-bit read/write register that specifies the oe and we signal assert/negate timing for pcmcia interfaces connected to areas 5 and 6. the oe and we signal assert pulse widths are designated by the wcr2 wait control bits. this register is initialized to h'0000 by a power-on reset, but is not initialized by a manual reset or in standby mode, and retains its contents. bit: 15 14 13 12 11 10 9 8 bit name: initial value: 0 0 0 0 0 0 0 0 r/w: r r r r r r r r bit: 7 6 5 4 3 2 1 0 bit name: a5ted1 a5ted0 a6ted1 a6ted0 a5teh1 a5teh0 a6teh1 a6teh0 initial value: 0 0 0 0 0 0 0 0 r/w: r/w r/w r/w r/w r/w r/w r/w r/w bits 15 to 8?eserved: these bits always read 0. the write value should always be 0.
218 bits 7 and 6?rea 5 address oe / we assert delay (a5ted1, a5ted0): these bits specify the address to oe / we assert delay time for the pcmcia interface connected to area 5. bit 7: a5ted1 bit 6: a5ted0 description 0 0 0.5 cycle delay (initial value) 1 1.5 cycle delay 1 0 2.5 cycle delay 1 3.5 cycle delay bits 5 and 4?rea 6 address oe / we assert delay (a6ted1, a6ted0): these bits specify the address to oe / we assert delay time for the pcmcia interface connected to area 6. bit 5: a6ted1 bit 4: a6ted0 description 0 0 0.5 cycle delay (initial value) 1 1.5 cycle delay 1 0 2.5 cycle delay 1 3.5 cycle delay bits 3 and 2?rea 5 oe / we negate address delay (a5teh1, a5teh0): these bits specify the oe / we negate address delay time for the pcmcia interface connected to area 5. bit 3: a5teh1 bit 2: a5teh0 description 0 0 0.5 cycle delay (initial value) 1 1.5 cycle delay 1 0 2.5 cycle delay 1 3.5 cycle delay
219 bits 1 and 0?rea 6 oe / we negate address delay (a6teh1, a6teh0): these bits specify the oe / we negate address delay time for the pcmcia interface connected to area 6. bit 1: a6teh1 bit 0: a6teh0 description 0 0 0.5 cycle delay (initial value) 1 1.5 cycle delay 1 0 2.5 cycle delay 1 3.5 cycle delay 10.2.8 synchronous dram mode register (sdmr) the synchronous dram mode register (sdmr) is written to via the synchronous dram address bus and is a virtual 8-bit write-only register. it sets synchronous dram mode for areas 2 and 3. sdmr settings must be made before synchronous dram is accessed. writes to the synchronous dram mode register use the address bus rather than the data bus. if the value to be set is x and the sdmr address is y, the value x is written in the synchronous dram mode register by writing in address x + y. since a0 of the synchronous dram is connected to a2 of the chip and a1 of the synchronous dram is connected to a3 of the chip, the value actually written to the synchronous dram is the x value shifted two bits right. for example, when h'0230 is written to the sdmr register of area 2, random data is written to the address h'fffd000 (address y) + h'08c0 (value x), or h'ffffd8c0. as a result, h'0230 is written to the sdmr register. when h'0230 is written to the sdmr register of area 3, random data is written to the address h'fffe000 (address y) + h'08c0 (value x) or h'ffffe8c0. as a result, h'0230 is written to the sdmr register. the range for value x is h'000 to h'0ffc. address bits bit: 31 12 11 10 9 8 bit name: sdmr address initial value: ????????? r/w: ????????? w* w* w w bit: 7 6 5 4 3 2 1 0 bit name: initial value: r/w: w w w w w w note: depending on the type of synchronous dram.
220 10.2.9 refresh timer control/status register (rtcsr) the refresh timer control/status register (rtscr) is a 16-bit read/write register that specifies the refresh cycle, whether to generate an interrupt, and the cycle of that interrupt. rtscr is initialized to h'0000 by a power-on reset, but is not initialized by a manual reset or in standby mode. note: the method for writing to rtcor is different from that for general registers to prevent inadvertent overwriting. using a word transfer instruction, place b'10100101 in the upper byte and the write data in the lower byte. for details, see section 10.2.13, cautions on accessing refresh control related registers. bit: 15 14 13 12 11 10 9 8 bit name: initial value: 0 0 0 0 0 0 0 0 r/w: r r r r r r r r bit: 7 6 5 4 3 2 1 0 bit name: cmf cmie cks2 cks1 cks0 ovf ovie lmts initial value: 0 0 0 0 0 0 0 0 r/w: r/w r/w r/w r/w r/w r/w r/w r/w bits 15 to 8?eserved: these bits always read 0. bit 7?ompare match flag (cmf): status flag that indicates that the values of rtcnt and rtcor match. bit 7: cmf description 0 the values of rtcnt and rtcor do not match. clearing condition: when a refresh is performed after 0 has been written in cmf and rfsh = 1 and rmode = 0 (to perform a cbr refresh). (initial value) 1 the values of rtcnt and rtcor match. setting condition: rtcnt = rtcor* note: contents do not change when 1 is written to cmf. bit 6?ompare match interrupt enable (cmie): enables or disables an interrupt request caused when the cmf bit in rtcsr is set to 1. do not set this bit to 1 when using cas-before-ras refreshing or auto-refreshing.
221 bit 6: cmie description 0 disables the interrupt request caused by cmf (initial value) 1 enables the interrupt request caused by cmf bits 5 to 3?lock select bits (cks2?ks0): these bits select the clock input to rtcnt. the source clock is the external bus clock (ckio). the rtcnt count clock is ckio scaled by the specified ratio. bit 5: cks2 bit 4: cks1 bit 3: cks0 description 0 0 0 disables clock input (initial value) 1 bus clock (ckio)/4 1 0 ckio/16 1 ckio/64 1 0 0 ckio/256 1 ckio/1024 1 0 ckio/2048 1 ckio/4096 bit 2?efresh count overflow flag (ovf): status flag that indicates when the number of refresh requests indicated in the refresh count register (rfcr) exceeds the limit set in the lmts bit in rtcsr. bit 2: ovf description 0 rfcr has not exceeded the count limit value set in lmts clearing condition: when 0 is written to ovf (initial value) 1 rfcr has exceeded the count limit value set in lmts setting condition: when the rfcr value has exceeded the count limit value set in lmts* note: contents do not change when 1 is written to ovf. bit 1?efresh count overflow interrupt enable (ovie): selects whether to suppress generation of interrupt requests by ovf when the ovf bit of rtcsr is set to 1.
222 bit 1: ovie description 0 disables interrupt requests caused by ovf (initial value) 1 enables interrupt requests caused by ovf bit 0?efresh count overflow limit select (lmts): indicates the count limit value to be compared to the number of refreshes indicated in the refresh count register (rfcr). when the value rfcr exceeds the value specified by lmts, the ovf flag is set. bit 0: lmts description 0 count limit value is 1024 (initial value) 1 count limit value is 512 10.2.10 refresh timer counter (rtcnt) rtcnt is a 16-bit read/write register containing an 8-bit counter that counts up on an input clock. the clock select bits (cks2?ks0) in rtcsr select the input clock. when rtcnt matches rtcor, the ovf bit in rtcsr is set and rtcnt is cleared. rtcnt is initialized to h'00 by a power-on reset; it continues incrementing after a manual reset; it is not initialized in standby mode, but retains its contents. note: the method for writing to rtcor is different from that for general registers to prevent inadvertent overwriting. using a word transfer instruction, place b'10100101 in the upper byte and the write data in the lower byte. for details, see section 10.2.13, cautions on accessing refresh control related registers. bit: 15 14 13 12 11 10 9 8 bit name: initial value: 0 0 0 0 0 0 0 0 r/w: r r r r r r r r bit: 7 6 5 4 3 2 1 0 bit name: initial value: 0 0 0 0 0 0 0 0 r/w: r/w r/w r/w r/w r/w r/w r/w r/w
223 10.2.11 refresh time constant register (rtcor) the refresh time constant register (rtcor) is a 16-bit read/write register. the values of rtcor and rtcnt (lower 8 bits) are constantly compared. when the values match, the compare match flag (cmf) in rtcsr is set and rtcnt is cleared to 0. when the refresh bit (rfsh) in the individual memory control register (mcr) is set to 1 and the refresh mode is set to cas-before- ras refresh, a memory refresh cycle occurs when the cmf bit is set. rtcor is initialized to h'00 by a power-on reset. it is not initialized by a manual reset or in standby mode, but retains its contents. note: the method for writing to rtcor is different from that for general registers to prevent inadvertent overwriting. using a word transfer instruction, place b'10100101 in the upper byte and the write data in the lower byte. for details, see section 10.2.13, cautions on accessing refresh control related registers. bit: 15 14 13 12 11 10 9 8 bit name: initial value: 0 0 0 0 0 0 0 0 r/w: r r r r r r r r bit: 7 6 5 4 3 2 1 0 bit name: initial value: 0 0 0 0 0 0 0 0 r/w: r/w r/w r/w r/w r/w r/w r/w r/w 10.2.12 refresh count register (rfcr) the refresh count register (rfcr) is a 16-bit read/write register containing a 10-bit counter that increments every time rtcor and rtcnt match. when rfcr exceeds the count limit value set by the lmts bit in rtcsr, the ovf bit in rtcsr is set and rfcr is cleared. rfcr is initialized to h'0000 by a power-on reset. it is not initialized by a manual reset or in standby mode, but retains its contents. note: the method for writing to rfcr is different from that for general registers to prevent inadvertent overwriting. using a word transfer instruction, place b'101001 in the top 6 bits of the upper byte, and the write data in the remaining bits. for details, see section 10.2.13, cautions on accessing refresh control related registers.
224 bit: 15 14 13 12 11 10 9 8 bit name: initial value: 0 0 0 0 0 0 0 0 r/w: r r r r r r r/w r/w bit: 7 6 5 4 3 2 1 0 bit name: initial value: 0 0 0 0 0 0 0 0 r/w: r/w r/w r/w r/w r/w r/w r/w r/w 10.2.13 cautions on accessing refresh control related registers rfcr, rtcsr, rtcnt, and rtcor require that a specific code be appended to the data when it is written to prevent data from being mistakenly overwritten by program overruns or other write operations (figure 10.5). perform reads and writes using the following methods: 1. when writing to rfcr, rtcsr, rtcnt, or rtcor, use only word transfer instructions. byte transfer instructions cannot be used. when writing to rtcnt, rtcsr, or rtcor, place b'10100101 in the upper byte and the write data in the lower byte. when writing to rfcr, place b'101001 in the top 6 bits and the write data in the remaining bits, as shown in figure 10.5. 2. when reading from rfcr, rtcsr, rtcnt, or rtcor, use a 16-bit access. 0 is read from undefined bits. 15 10 8 rtcsr, rtcnt, rtcor 0 rfcr 7 100101 15 10 10 0 9 1 0 0 1 write data write data figure 10.5 writing to rfcr, rtcsr, rtcnt, and rtcor
225 10.3 bsc operation 10.3.1 endian/access size and data alignment the sh7708 seires supports both big-endian mode, in which the 0 address is the most significant byte in the byte data, and little-endian mode, in which the 0 address is the least significant byte. switching between the two is designated by an external pin (md5 pin) at the time of a power-on reset. after a power-on reset, big-endian mode is set when md5 is low, and little-endian mode is set when md5 is high. three data bus widths are available for normal memory (byte, word, longword) and two data bus widths (word and longword) for dram and pseudo-sram. only longword is available for synchronous dram. for the pcmcia interface, choose from byte and word. this means data alignment is done by matching the device? data width and endian. the access unit must also be matched to the device? bus width. this also means that when longword data is read from a byte- width device, four read operations must be executed. in the sh7708 series, data alignment and conversion of data length is performed automatically between the respective interfaces. tables 10.6 through 10.11 show the relationship between endian, device data width, and access unit. table 10.6 32-bit external device/big endian access and data alignment data bus strobe signal operation d31?24d23?16d15?8d7?0 we3 , cashh , dqmuu we2 , cashl , dqmul we1 , caslh , dqmlu we0 , casll , dqmll address 0 byte access data 7? asserted address 1 byte access data 7? asserted address 2 byte access data 7? asserted address 3 byte access data 7? asserted address 0 word access data 15? data 7? asserted asserted address 2 word access data 15? data 7? asserted asserted address 0 longword access data 31?4 data 23?6 data 15? data 7? asserted asserted asserted asserted
226 table 10.7 16-bit external device/big endian access and data alignment data bus strobe signal operation d31 d24 d23 d16 d15?8d7?0 we3 , cashh , dqmuu we2 , cashl , dqmul we1 , caslh , dqmlu we0 , casll , dqmll address 0 byte access data 7? asserted address 1 byte access data 7? asserted address 2 byte access data 7? asserted address 3 byte access data 7? asserted address 0 word access data 15? data 7? asserted asserted address 2 word access data 15? data 7? asserted asserted address 0 longword access 1st time (address 0) data 31?4 data 23?6 asserted asserted 2nd time (address 2) data 15? data 7? asserted asserted
227 table 10.8 8-bit external device/big endian access and data alignment data bus strobe signal operation d31 d24 d23 d16 d15 d8 d7?0 we3 , cashh , dqmuu we2 , cashl , dqmul we1 , caslh , dqmlu we0 , casll , dqmll address 0 byte access data 7? asserted address 1 byte access data 7? asserted address 2 byte access data 7? asserted address 3 byte access data 7? asserted address 0 word access 1st time (address 0) data 15? asserted 2nd time (address 1) data 7? asserted address 2 word access 1st time (address 2) data 15? asserted 2nd time (address 3) data 7? asserted address 0 longword access 1st time (address 0) data 31?4 asserted 2nd time (address 1) data 23?6 asserted 3rd time (address 2) data 15? asserted 4th time (address 3) data 7? asserted
228 table 10.9 32-bit external device/little endian access and data alignment data bus strobe signal operation d31?24d23?16d15?8 d7?0 we3 , cashh , dqmuu we2 , cashl , dqmul we1 , caslh , dqmlu we0 , casll , dqmll address 0 byte access data 7? asserted address 1 byte access data 7? asserted address 2 byte access data 7? asserted address 3 byte access data 7? asserted address 0 word access data 15? data 7? asserted asserted address 2 word access data 15? data 7? asserted asserted address 0 longword access data 31?4 data 23?6 data 15? data 7? asserted asserted asserted asserted
229 table 10.10 16-bit external device/little endian access and data alignment data bus strobe signal operation d31 d24 d23 d16 d15?8d7?0 we3 , cashh , dqmuu we2 , cashl , dqmul we1 , caslh , dqmlu we0 , casll , dqmll address 0 byte access data 7? asserted address 1 byte access data 7? asserted address 2 byte access data 7? asserted address 3 byte access data 7? asserted address 0 word access data 15? data 7? asserted asserted address 2 word access data 15? data 7? asserted asserted address 0 longword access 1st time (address 0) data 15? data 7? asserted asserted 2nd time (address 2) data 31?4 data 23?6 asserted asserted
230 table 10.11 8-bit external device/little endian access and data alignment data bus strobe signal operation d31 d24 d23 d16 d15 d8 d7?0 we3 , cashh , dqmuu we2 , cashl , dqmul we1 , caslh , dqmlu we0 , casll , dqmll address 0 byte access data 7? asserted address 1 byte access data 7? asserted address 2 byte access data 7? asserted address 3 byte access data 7? asserted address 0 word access 1st time (address 0) data 7? asserted 2nd time (address 1) data 15? asserted address 2 word access 1st time (address 2) data 7? asserted 2nd time (address 3) data 15? asserted address 0 longword access 1st time (address 0) data 7? asserted 2nd time (address 1) data 15? asserted 3rd time (address 2) data 23?6 asserted 4th time (address 3) data 31?4 asserted
231 10.3.2 description of areas area 0: area 0 physical address bits a28?26 are 000. address bits a31?29 are ignored and the address range is h'00000000 + h'20000000 n ?h'03ffffff + h'20000000 n (n = 0?, n = 1? is the shadow space). normal memories such as sram, rom, and burst rom can be connected to this space. byte, word, or longword can be selected as the bus width using external pins. md3 and md4 on a power-on reset. for details, see memory size in section 10.1.5. when the area 0 space is accessed, the cs0 signal is asserted. the rd signal that can be used as oe and the we0 we3 signals for write control are also asserted. the number of bus cycles is selected between 0 and 10 wait cycles using the a0w2?0w0 bits in wcr2. also, any number of waits can be inserted in each bus cycle by means of the external wait pin ( wait ). when the burst function is used, the bus cycle pitch of the burst cycle is determined within a range of 2?0 according to the number of waits. area 1: area 1 physical address bits a28?26 are 001. address bits a31?29 are ignored and the address range is h'04000000 + h'20000000 n ?h'07ffffff + h'20000000 n (n = 0?, n = 1? is the shadow space). only normal memories like sram and rom can be connected to this space. byte, word, or longword can be selected as the bus width using the a1sz1?1sz0 bits in bcr2. when the area 1 space is accessed, the cs1 signal is asserted. the rd signal that can be used as oe and the we0 we3 signals for write control are also asserted. the number of bus cycles is selected between 0 and 3 wait cycles using the a12w1?12w0 bits in wcr2. also, any number of waits can be inserted in each bus cycle by means of the external wait pin ( wait ). area 2: area 2 physical address bits a28?26 are 010. address bits a31?29 are ignored and the address range is h'08000000 + h'20000000 n ?h'0bffffff + h'20000000 n (n = 0?, n = 1? is the shadow space). normal memories like sram and rom, as well as dram and synchronous dram, can be connected to this space. byte, word, or longword can be selected as the bus width using the a2sz1?2sz0 bits in bcr2 for normal memory. for synchronous dram, set longword using the sz bit in mcr. when dram is connected to area 2, the bus width is fixed at 16 bits. the bus width for area 3 also needs to be 16 bits. when the area 2 space is accessed, the cs2 signal is asserted. when normal memories are connected, the rd signal that can be used as oe and the we0 we3 signals for write control are also asserted and the number of bus cycles is selected between 0 and 3 wait cycles using the a12w1 to a12w0 bits in wcr2. when normal memory is connected, only, any number of waits can be inserted in each bus cycle by means of the external wait pin ( wait ).
232 when synchronous dram is connected, the ras signal, cas signal, rd/ wr signal, and byte control signals dqmhh, dqmhl, dqmlh, and dqmll are all asserted and addresses multiplexed. control of ras , cas , data timing, and address multiplexing is set with mcr. when dram is connected, the ras2 signal, cas2h signal, cas2l signal, and rd/ wr signal are all asserted and addresses multiplexed. control of ras2 , cas , data timing, and address multiplexing is set with dcr. area 3: area 3 physical address bits a28?26 are 011. address bits a31?29 are ignored and the address range is h'0c000000 + h'20000000 n ?h'0fffffff + h'20000000 n (n = 0?, n = 1? is the shadow space). normal memories like sram and rom, as well as dram, pseudo-sram, and synchronous dram, can be connected to this space. byte, word or longword can be selected as the bus width using the a3sz1?3sz0 bits in bcr2 for normal memory. for dram and pseudo-sram, word or longword can be selected using the sz bit in mcr. when synchronous dram is connected, set to longword using the sz bit in mcr. when area 3 space is accessed, cs3 is asserted. when normal memories are connected, the rd signal that can be used as oe and the we0 we3 signals for write control are asserted and the number of bus cycles is selected between 0 and 3 wait cycles using the a3w1?3w0 bits in wcr2. when normal memory is connected, only, any number of waits can be inserted in each bus cycle by means of the external wait pin ( wait ). when synchronous dram is connected, the ras signal, cas signal, rd/ wr signal, and byte control signals dqmhh, dqmhl, dqmlh, and dqmll are all asserted and addresses multiplexed. when dram is connected, the ras signal, cashh signal, cashl signal, caslh signal, casll signal, and rd/ wr signal are all asserted and addresses multiplexed. when pseudo-sram is connected, the ce signal, oe / rfsh signal, and we0 , we1 , we2 , and we3 signals are asserted. for all of these, control of ras , cas , and data timing and of address multiplexing is set with mcr. area 4: area 4 physical address bits a28?26 are 100. address bits a31?29 are ignored and the address range is h'10000000 + h'20000000 n ?h'13ffffff + h'20000000 n (n = 0?, n = 1? is the shadow space). only normal memories like sram and rom can be connected to this space. byte, word, or longword can be selected as the bus width using the a4sz1?4sz0 bits in bcr2. when the area 4 space is accessed, the cs4 signal is asserted. the rd signal that can be used as oe and the we0 we3 signals for write control are also asserted. the number of bus cycles is selected between 0 and 10 wait cycles using the a4w2?4w0 bits in wcr2. also, any number of waits can be inserted in each bus cycle by means of the external wait pin ( wait ).
233 area 5: area 5 physical address bits a28?26 are 101. address bits a31?29 are ignored and the address range is the 64 mbytes at h'14000000 + h'20000000 n ?h'17ffffff + h'20000000 n (n = 0?, n = 1? is the shadow space). normal memories like sram and rom as well as burst rom and pcmcia interfaces can be connected to this space. pcmcia interfaces only use their ic memory card interface, so the address range becomes the 32 mbytes at h'14000000 + h'20000000 n ?h'15ffffff + h'20000000 n (n = 0?, n = 1? is the shadow space). for normal memory and burst rom, byte, word, or longword can be selected as the bus width using the a5sz1?5sz0 bits in bcr2. for the pcmcia interface, byte, and word can be selected as the bus width using the a5sz1?5sz0 bits in bcr2. when the area 5 space is accessed and normal memory is connected, the cs5 signal is asserted. the rd signal that can be used as oe and the we0 we3 signals for write control are also asserted. when the pcmcia interface is used, the ce1 signal, ce2 signal, oe signal, and we signal are asserted. the number of bus cycles is selected between 0 and 10 wait cycles using the a5w2?5w0 bits in wcr2. also, any number of waits can be inserted in each bus cycle by means of the external wait pin ( wait ). when a burst function is used, the bus cycle pitch of the burst cycle is determined within a range of 2?0 according to the number of waits. the setup and hold times of address/ ce1a / ce2a for the read/write strobe signals can be set within a range of 0.5?.5 cycles using the a5ted1?5ted0 and a5teh1?5teh0 bits in the pcr register. area 6: area 6 physical address bits a28?26 are 110. address bits a31?29 are ignored and the address range is the 64 mbytes at h'18000000 + h'20000000 n ?h'1bffffff + h'20000000 n (n = 0?, n = 1? is the shadow space). normal memories like sram and rom as well as burst rom and pcmcia interfaces can be connected to this space. when the pcmcia interface is used, the ic memory card interface address range is the 32 mbytes at h'18000000 + h'20000000 n ?h'19ffffff + h'20000000 n and the i/o card interface address range is the 32 mbytes at h'1a000000 + h'20000000 n h'1bffffff + h'20000000 n (n = 0?, n = 1? is the shadow space). for normal memory and burst rom, byte, word, or longword can be selected as the bus width using the a6sz1?6sz0 bits in bcr2. for the pcmcia interface, byte, and word can be selected as the bus width using the a6sz1?6sz0 bits in bcr2. when the area 6 space is accessed and normal memory is connected, the cs6 signal is asserted. the rd signal that can be used as oe and the we0 we3 signals for write control are also asserted. when the pcmcia interface is used, the ce1b signal, ce2b signal, oe signal, and we1 , icord , and icowr signals are asserted.
234 the number of bus cycles is selected between 0 and 10 wait cycles using the a6w2?6w0 bits in wcr2. also, any number of waits can be inserted in each bus cycle by means of the external wait pin ( wait ). when the burst function is used, the bus cycle pitch of the burst cycle is determined within a range of 2?0 according to the number of waits. the setup and hold times of address/ ce1b / ce2b for the read/write strobe signals can be set within a range of 0.5?.5 cycles using a6ted1?6ted0 and a6teh1?6teh0. if pcmcia is used in area 6, synchronous dram is used at the same time, and a synchronous dram auto-refresh (cas-before-ras refresh) request is issued simultaneously, area 6 card enable signals cs6 and ce2b may be asserted earlier than usual, at the same time as the immediately preceding auto-refresh cycle. when both pcmcia and synchronous dram are used, they should be used in area 5. when area 5 is used, the system design should provide for cs to be asserted early without causing any problems. 10.3.3 basic interface basic timing: the basic interface of the sh7708 series uses strobe signal output because mainly sram will be directly connected. figure 10.6 shows the basic timing of normal space accesses. a no-wait normal access is completed in two cycles. the bs signal is asserted for one cycle to indicate the start of a bus cycle. the csn signal is negated on the t2 clock falling edge to secure the negation period. therefore, at minimum pitch, there is a half-cycle negation period. there is no access size specification when reading. the correct access start address is output in the least significant bit of the address, but since there is no access size specification, 32 bits are always read in a 32-bit device, and 16 bits in a 16-bit device. when writing, only the we signal for the byte to be written is asserted. for details, see section 10.3.1, endian/access size and data alignment. read/write for cache fill or copy-back follows the set bus width and transfers a total of 16 bytes continuously. the bus is not released during this transfer. for cache misses that occur during byte or word operand accesses or branching to odd word boundaries, the fill is always performed by longword accesses on the chip-external interface. write-through area write access and noncacheable read/write access is based on the actual address size.
235 t1 ckio a25 to a0 csn rd/ wr rd d31 to d0 wen d31 to d0 bs t2 read write figure 10.6 basic timing of basic interface
236 figures 10.7, 10.8, and 10.9 show examples of connection to 32-, 16-, and 8-bit data width sram. a16 a0 cs oe i/o7 i/o0 we a18 a2 csn rd d31 d24 we3 d23 d16 we2 d15 d8 we1 d7 d0 we0 sh7708 series 128k 8 bit sram a16 a0 cs oe i/o7 i/o0 we a16 a0 cs oe i/o7 i/o0 we a16 a0 cs oe i/o7 i/o0 we figure 10.7 example of 32-bit data width sram connection
237 a16 a0 cs oe i/o7 i/o0 we a17 a1 csn rd d15 d8 we1 d7 d0 we0 sh7708 series 128k 8 bit sram a16 a0 cs oe i/o7 i/o0 we figure 10.8 example of 16-bit data width sram connection a16 a0 csn rd d7 d0 we0 sh7708 series 128k 8 bit sram a16 a0 cs oe i/o7 i/o0 we figure 10.9 example of 8-bit data width sram connection
238 wait state control: wait state insertion on the basic interface can be controlled by the wcr2 settings. if the wcr2 wait specification bits corresponding to a particular area are not zero, a software wait is inserted in accordance with that specification. for details, see section 10.2.4, wait control register 2 (wcr2). the specified number of tw cycles is inserted as wait cycles using the basic interface wait timing shown in figure 10.10. t1 ckio a25 to a0 csn rd/ wr rd d31 to d0 wen d31 to d0 bs tw t2 read write figure 10.10 basic interface wait timing (software wait only)
239 when software wait insertion is specified by wcr2, the external wait input wait signal is also sampled. wait pin sampling is shown in figure 10.11. a 2-cycle wait is specified as a software wait. sampling is performed at the transition from the tw state to the t2 state; therefore, the wait signal has no effect if asserted in the t1 cycle or the first tw cycle. the wait signal is sampled on the rising edge of the clock. wait is a synchronous signal. t1 ckio a25 to a0 csn rd/ wr rd d31 to d0 wen d31 to d0 wait tw tw tw t2 read write bs wait states inserted by wait signal figure 10.11 basic interface wait state timing (wait state insertion by wait signal)
240 10.3.4 dram interface dram connection method: when the memory type bits (dramtp2?ramtp0) in bcr1 are set to 100, area 3 becomes dram space; when set to 101, area 2 and area 3 become dram space. the dram interface function can then be used to connect the sh7708 series directly to dram. 16 or 32 bits can be selected as the interface data width for area 3 when bits dramtp2 to dramtp0 are set to 100, and 16 bits can be used for both area 2 and area when bits dramtp2 to dramtp0 are set to 101. 2-cas 16-bit drams can be connected, since cas is used to control byte access. signals used for connection when dram is connected to area 3 are ras , cashh , cashl , caslh , casll , and rd/ wr . cashh and cash l are not used when the data width is 16 bits. when dram is connected to areas 2 and 3, the signals for area 2 dram connection are ras2 , cas2h , cas2l , and rd/ wr , and those for area 3 dram connection are ras , caslh , casll , and rd/ wr . in addition to normal read and write access modes, high-speed page mode is supported for burst access. also, for dram connected to area 3, edo mode, which enables the dram access time to be increased by delaying the data sampling timing by 1/2 clock when reading, is supported in addition to normal read and write access for burst mode.
241 a10 a2 ras rd/ wr d31 d16 cashh cashl d15 d0 caslh casll sh7708 series 256k 16 bit dram a8 a0 ras oe we i/o15 i/o0 ucas lcas a8 a0 ras oe we i/o15 i/o0 ucas lcas figure 10.12 example of dram connection (32-bit data width)
242 a9 a1 ras ras2 rd/ wr d15 d0 caslh casll cas2h cas2l sh7708 series 256k 16 bit dram a8 a0 ras oe we i/o15 i/o0 ucas lcas a8 a0 ras oe we i/o15 i/o0 ucas lcas figure 10.13 example of dram connection (16-bit data width)
243 address multiplexing: when areas 2 and 3 are designated as dram space, address multiplexing is always performed in accesses to dram. this enables dram, which requires row and column address multiplexing, to be connected directly to the sh7708 series without using an external address multiplexer circuit. any of the four multiplexing methods shown below can be selected by setting bits amx1 and amx0 in mcr for area 3 dram, or bits amx1 and amx0 in dcr for area 2 dram. the relationship between bits amx1 and amx0 and address multiplexing is shown in table 10.12. the address output pins subject to address multiplexing are a15 to a1. pins a25 to a16 carry the original address. table 10.12 relationship between amx1-0 and address multiplexing setting number of column amx1 amx0 address bits output timing external address pins 0 0 8 bits column address a1 to a14 a15 row address a9 to a22 a23 0 1 9 bits column address a1 to a14 a15 row address a10 to a23 a24 1 0 10 bits column address a1 to a14 a15 row address a11 to a24 a25 1 1 11 bits column address a1 to a14 a15 row address a12 to a25 a15
244 basic timing: figure 10.14 shows the basic timing for dram access is 3 cycles. tpc is the precharge cycle, tr the ras assert cycle, tc1 the cas assert cycle, and tc2 the read data latch cycle. ckio rd/ wr d31 to d0 (read) d31 to d0 (write) ras casxx bs cs2 or cs3 a25 to a16 a15 to a0 tr tc1 tc2 (tpc) figure 10.14 basic timing for dram access
245 wait state control: as the clock frequency increases, it becomes impossible to complete all states in one cycle as in basic access. therefore, provision is made for state extension by using the setting bits in wcr2, mcr, and dcr. the timing with state extension using these settings is shown in figure 10.15. up to four additional tpc cycles (cycles used to secure the ras precharge time) can be inserted by means of the tpc bits in mcr and dcr. however, if there is a dram access request immediately after an auto-refresh (cas-before-ras refresh), the interval until the next assertion of ras is 2 cycles, regardless of the values in mcr and dcr. the number of cycles from ras assertion to cas assertion can be set to between 1 and 4 by inserting trw cycles by means of the rcd bits in mcr and dcr. the number of cycles from cas assertion to the end of the access can be varied between 1 and 3 according to the setting of a1?w (1,0) or a3w (1,0) in wcr2.
246 ckio rd/ wr d31 to d0 (read) d31 to d0 (write) ras casxx bs cs2 or cs3 a25 to a16 a15 to a0 tr trw trw tc1 tcw tc2 (tpc) (tpc) row address row address column address figure 10.15 dram wait state timing
247 burst access: in addition to the normal dram access mode in which a row address is output in each data access, a high-speed page mode is also provided in cases where consecutive accesses are made to the same row. this mode allows fast access to data by outputting the row address only once, then changing only the column address for each subsequent access. normal access or burst access using high-speed page mode can be selected by means of the burst enable (be) bit in mcr and dcr. the timing for burst access using high-speed page mode is shown in figure 10.16. in burst transfer, 4 (longword access) or 16 (cache fill or cache write-back) bytes of data are burst- transferred in a 16-bit bus size. with a 32-bit bus size, 16 bytes of data are burst-transferred (cache fill or cache write-back). in a 16-byte burst transfer (cache fill), the first access comprises a longword that includes the data requiring access. the remaining accesses are performed on 16-byte boundary data that includes the relevant data. in burst transfer (cache write-back), sequential writing is performed if first-to-last order for 16-byte boundary data.
248 ckio rd/ wr d31 to d0 (read) d31 to d0 (write) ras casxx bs cs2 or cs3 a25 to a16 a15 to a0 tr tc2 (tpc) tc1 tc2 tc1 tc2 tc1 tc2 tc1 row address row address column address column address column address column address figure 10.16 dram burst access timing
249 edo mode: in dram, an extended data out (edo) mode is also provided in which, once the cas signal is asserted while the ras signal is asserted, even if the cas signal is negated, data is output to the data bus until the cas signal is next asserted. (this is in addition to the mode in which data is output to the data bus only while the cas signal is asserted in a data read cycle.) in the sh7708 series, the edo mode bit (edomode) in mcr enables selection, for area 3 dram only, of either normal access/burst access using high-speed page mode or edo mode normal access/burst access. edo mode normal access is shown in figure 10.17, and burst access in figure 10.18. in edo mode, the timing for data output to the data bus in a read cycle is extended as far as the next assertion of the cas signal. this delays the data latch timing by 1/2 cycle to the rising edge of the ckio clock, enabling the dram access time to be increased.
250 tr tc1 tc2 (tpc) ckio a25?16 a15?0 rd/ wr ras casxx d31?0 (read) d31?0 (write) bs cs2 or cs3 row address column address row address figure 10.17 normal access timing in dram edo mode
251 ckio rd/ wr d31 to d0 (read) d31 to d0 (write) ras casxx bs cs2 or cs3 a25 to a16 a15 to a0 tr tc2 (tpc) tc1 tc2 tc1 tc2 tc1 tc2 tc1 row address column address column address column address column address row address figure 10.18 burst access timing in dram edo mode
252 refresh timing: the bus state controller includes a function for controlling dram refreshing. refreshing using a cas-before-ras cycle can be performed by clearing the rmode bit to 0 and setting the rfsh bit to 1 in mcr for area 3 dram, or by clearing the rmode bit to 0 and setting the rfsh bit to 1 in dcr for area 2 dram. it also supports self-refresh mode. when cas-before-ras refresh cycles are executed, refreshing is performed at intervals determined by the input clock selected by bits cks2?ks0 in rtcsr, and the value set in rtcor. the value of bits cks2?ks0 in rtcor should be set so as to satisfy the stipulation for the dram refresh interval. first make the settings for rtcor, rtcnt, and the rmode and rfsh bits in mcr, then make the cks2?ks0 setting. when the clock is selected by cks2 to cks0, rtcnt starts counting up from the value at that time. the rtcnt value is constantly compared with the rtcor value, and if the two values are the same, a refresh request is generated and the irqout pin goes low. if the sh7708 series?external bus can be used, cas-before-ras refreshing is performed, and if there is no other interrupt request the irqout pin goes high. at the same time, rtcnt is cleared to zero and the count-up is restarted. figure 10.19 shows the operation of cas-before-ras refreshing. rtcor value rtcnt h'00000000 rtcsr.cks(2?) cmf external bus cmf flag cleared by start of refresh cycle = 000 1 000 rtcnt cleared to 0 when rtcnt = rtcor cas-before-ras refresh cycle time figure 10.19 cas-before-ras refresh operation
253 figure 10.20 shows the timing of the cas-before-ras refresh cycle. the number of ras assert cycles in the refresh cycle is specified by the tras bits in mcr and dcr. the specification of the ras precharge time in the refresh cycle is determined by the setting of the tpc bits in mcr and dcr in the same way as for normal access. trc trr1 trr2 (tpc) ckio rd/ wr ras casxx cs2 or cs3 (high) figure 10.20 dram cas-before-ras refresh cycle timing the self-refreshing supported by the sh7708 series is shown in figure 10.21. after the self-refresh is cleared, the refresh controller immediately generates a refresh request. the ras precharge time immediately after the end of the self-refreshing can be set by the tpc bits in mcr and dcr. drams include low-power products (l versions) with a long refresh cycle time (for example, the l version of the hm51w4160al has a refresh cycle of 1024 cycles/128 ms compared with 1024 cycles/16 ms for the normal version). with these drams, however, the same refresh cycle as the normal version is requested only when refreshing immediately after self-refreshing. therefore, to ensure efficient dram refreshing, an overflow interrupt is generated and the refresh cycle is restored to its proper value. this occurs after the necessary cas-before-ras refreshing has been performed following self-refreshing of an l-version dram, using rfcr and the ovf, ovie, and lmts bits in rtcsr. the procedure is as follows.
254 1. normally, set the refresh counter count value to the optimum value for the l version (e.g. 1024 cycles/128 ms). 2. when a transition is made to self-refreshing: a. provide an interrupt handler to restore the refresh counter count value to the optimum value for the l version (e.g. 1024 cycles/128 ms) when a refresh counter overflow interrupt is generated. b. reset the refresh counter count value to the requested short cycle (e.g. 1024 cycles/16 ms), set refresh controller overflow interruption, and clear the refresh count register (rfcr) to 0. c. set self-refresh mode. this procedure causes refreshing immediately following a self-refresh to occur in a short cycle. when adequate refreshing ends, an interrupt is generated and the setting can be restored to the original refresh cycle. cas-before-ras refreshing is performed in normal operation, in sleep mode, and in a manual reset. self-refreshing is performed in normal operation, in sleep mode, in standby mode, and in a manual reset. when the bus has been released in response to a bus arbitration request, or when a transition is made to standby mode, signals generally become high-impedance. controlling the ras and cas signals to become high-impedance or continue to be output is performed with the hizcnt bit in bcr1. this enables the dram to be kept in the self-refreshing state.
255 trc trr1 trrw tsr1 tsr1 tsr2 (tpc) ckio rd/ wr ras casxx cs2 or cs3 (tpc) (high) figure 10.21 dram self-refresh cycle timing power-on sequence: for dram after powering on, a minimum wait time of 100 m s or 200 m s, or more during which no access can be performed, should be provided, followed by the prescribed number (usually 8 or more) of dummy cas-before-ras refresh cycles. as the bus state controller does not perform any special operations for a power-on reset, the power-on sequence must be carried out by the initialization program executed after a power-on reset.
256 10.3.5 synchronous dram interface synchronous dram direct connection: since synchronous dram can be selected by the cs signal, physical space areas 2 and 3 can be connected using ras and other control signals in common. if the memory type bits (dramtp2?ramtp0) in bcr1 are set to 010, area 2 is normal memory space and area 3 is synchronous dram space; if set to 011, areas 2 and 3 are both synchronous dram space. with the sh7708 series, burst length 1 burst read/single write mode is supported as the synchronous dram operating mode. the data bus width is fixed at 32 bits, and the size bit (sz) in mcr must be set to 1. the burst enable bit (be) in mcr is ignored, a16-bit burst transfer is performed in a cache fill/copy-back cycle, and only one access is performed in a write-through area write or a noncacheable area read/write. the control signals for direct connection of synchronous dram are ras , cas , rd/ wr , cs2 or cs3 , dqmuu, dqmul, dqmlu, dqmll, and cke. all the signals other than cs2 and cs3 are common to all areas, and signals other than cke are valid and fetched to the synchronous dram only when cs2 or cs3 is asserted. synchronous dram can therefore be connected in parallel to a number of areas. cke is negated (low) only when self-refreshing is performed, otherwise it is asserted (high). commands for synchronous dram are specified by ras , cas, rd/ wr , and special address signals. the commands are nop, auto-refresh (ref), self-refresh (self), precharge all banks (pall), precharge specified bank (p re), row address strobe bank active (actv), read (read), read with precharge (reada), write (writ), write with precharge (writa), and mode register write (mrs). byte specification is performed by dqmuu, dqmul, dqmlu, and dqmll. a read/write is performed for the byte for which the corresponding dqm is low. in big-endian mode, dqmuu specifies an access to address 4n, and dqmll specifies an access to address 4n + 3. in little-endian mode, dqmuu specifies an access to address 4n + 3, and dqmll specifies an access to address 4n. figure 10.22 shows an example of the connection of 256k 16-bit synchronous drams.
257 a11 a2 cki0 cke csn ras cas rd/ wr d31 d16 dqmuu dqmul d15 d0 dqmlu dqmll sh7708 series 256k 16-bit synchronous dram a9 a0 clk cke cs ras cas we i/o15 i/o0 dqmu dqml a9 a0 clk cke cs ras cas we i/o15 i/o0 dqmu dqml figure 10.22 example of synchronous dram connection
258 address multiplexing: synchronous dram can be connected without external multiplexing circuitry in accordance with the address multiplex specification bits amx1 and amx0 in mcr. table 10.13 shows the relationship between the address multiplex specification bits and the bits output at the address pins. a25?16 and a0 are not multiplexed; the original values are always output at these pins. when a0, the lsb of the synchronous dram address, is connected to the sh7708 series, it performs longword address specification. connection should therefore be made in this order: connect pin a0 of the synchronous dram to pin a2 of the sh7708 series, then connect pin a1 to pin a3. table 10.14 shows the example of correspondence between sh7708 series and synchronous dram address pins. table 10.13 relationship between sz, amx, and address multiplex output setting external address pins amx1 amx0 output timing a1 to a8 a 9 a 1 0 a 1 1 a 1 2 a 1 3 a 1 4 a 1 5 0 0 column address a1 to a8 a9 a10 a11 l/h* 1 a21* 2 a14 a15 row address a9 to a16 a17 a18 a19 a20 a21* 2 a22 a23 0 1 column address a1 to a8 a9 a10 a11 l/h* 1 a22* 2 a14 a15 row address a10 to a17 a18 a19 a20 a21 a22* 2 a23 a24 1 0 column address a1 to a8 a9 a10 a11 l/h* 1 a23* 2 a14 a15 row address a11 to a18 a19 a20 a21 a22 a23* 2 a24 a25 1 1 column address a1 to a8 a9 l/h* 1 a19* 2 a12 a13 a14 a15 row address a9 to a16 a17 a18 a19* 2 a20 a21 a22 a23 notes: 1. l/h is a bit used in the command specification; it is fixed at l or h according to the access mode. 2. bank address specification.
259 table 10.14 example of correspondence between sh7708 series and synchronous dram address pins (amx (1-0) = 11) sh7708 series address pin synchronous ras cycle cas cycle dram address pin function a11 a19 a19 a9 bank select bank address a10 a18 l/h a8 address precharge setting a9 a17 a9 a7 address a8 a16 a8 a6 a7 a15 a7 a5 a6 a14 a6 a4 a5 a13 a5 a3 a4 a12 a4 a2 a3 a11 a3 a1 a2 a10 a2 a0 a1 a9 a1 not used a0 a0 a0 not used burst read: the timing chart for a burst read is shown in figure 10.23. in the following example it is assumed that four 2m 8-bit synchronous drams are connected and a 32-bit data width is used, and the burst length is 1. following the tr cycle in which actv command output is performed, a read command is issued in the tc1, tc2, and tc3 cycles, and a reada command in the tc4 cycle. the read data is then accepted on the rising edge of the external command clock (ckio) from cycle td1 to cycle td4. the tpc cycle is used to wait for completion of auto-precharge based on the reada command inside the synchronous dram; no new access command can be issued to the same bank during this cycle, but access to synchronous dram for another area is possible. in the sh7708 series, the number of tpc cycles is determined by the tpc bit specification in mcr, and commands cannot be issued for the same synchronous dram during this interval. the example in figure 10.23 shows the basic timing. to connect slower synchronous dram, the cycle can be extended by setting the wcr2 and mcr bits. the number of cycles from the actv command output cycle, tr, to the read command output cycle, tc1, can be specified by the rcd bit in mcr, with a value of 0 to 3 specifying 1 to 4 cycles, respectively. for 2 or more cycles, a trw cycle, in which an nop command is issued for the synchronous dram, is inserted between the tr cycle and the tc cycle. the number of cycles from read and reada command output cycles tc1?c4 to the first read data latch cycle, td1, can be specified as 1 to 3 cycles independently for areas 2 and 3 by means of a1?w1 and a1?w0 or a3w1 and a3w0 in wcr2. this number of cycles corresponds to the number of synchronous dram cas latency cycles.
260 ckio a25 to a16, a13 a12 a15, a14, a11 to a0 cs2 or cs3 ras cas rd/ wr dqmxx d31 to d0 bs tr tc1 tc2/td1 tc3/td2 tc4/td3 td4 tpc figure 10.23 basic timing for synchronous dram burst read
261 figure 10.24 shows the burst read timing when rcd is set to 1, a3w1 and a3w0 are set to 10, and tpc is set to 1. the bs cycle, which is asserted for one cycle at the start of a bus cycle for normal access space, is asserted in each of cycles td1?d4 in a synchronous dram cycle. when a burst read is performed, the address is updated each time cas is asserted. as the unit of burst transfer is 16 bytes, address updating is performed for a3 and a2 only. in a fill operation in the event of a cache miss, the order of access is: the missed data is read first, then 16-byte boundary data including the missed data is read in wraparound mode. ckio a25 to a16, a13 a12 a15, a14, a11 to a0 cs2 or cs3 ras cas rd/ wr dqmxx d31 to d0 bs tr tc1 tc2 tc3/td1 tc4/td2 td3 tpc trw td4 figure 10.24 synchronous dram burst read wait specification timing
262 single read: figure 10.25 shows the timing when a single address read is performed. as the burst length is set to 1 in synchronous dram burst read/single write mode, only the required data is output. consequently, no unnecessary bus cycles are generated even when a cache-through area is accessed. ckio a25 to a16, a13 a12 a15, a14, a11 to a0 cs2 or cs3 ras cas rd/ wr dqmxx d31 to d0 bs tr tc1 td1 tpc figure 10.25 basic timing for synchronous dram single read
263 burst write: the timing chart for a burst write is shown in figure 10.26. in the sh7708 series, a burst write occurs only in the event of cache copy-back. in a burst write operation, following the tr cycle in which actv command output is performed, a writ command is issued in the tc1, tc2, and tc3 cycles, and a writa command that performs auto-precharge is issued in the tc4 cycle. in the write cycle, the write data is output at the same time as the write command. for the write with auto-precharge command, precharging of the relevant bank is performed in the synchronous dram after completion of the write command, and therefore no command can be issued for the same bank until precharging is completed. consequently, in addition to the precharge wait cycle, tpc, used in a read access, cycle trwl is added as a wait interval until precharging is started, following the write command. issuance of a new command for the same bank is postponed during this interval. the number of trwl cycles can be specified by the trwl bit in mcr.
264 ckio csn rd/ wr ras casxx dqmxx d31 to d0 (read) bs tr tc1 tc2 tc3 tc4 (trwl) (tpc) address upper bits a12, a11, a10 or a9 address lower bits figure 10.26 basic timing for synchronous dram burst write
265 single write: the basic timing chart for write access is shown in figure 10.27. in a single write operation, following the tr cycle in which actv command output is performed, a writa command that performs auto-precharge is issued in the tc1 cycle. in the write cycle, the write data is output at the same time as the write command. for the write with auto-precharge command, precharging of the relevant bank is performed in synchronous dram after completion of the write command, and therefore no command can be issued for the same bank until precharging is completed. consequently, in addition to the precharge wait cycle, tpc, used in a read access, cycle trwl is also added as a wait interval until precharging is started following the write command. issuance of a new command for the same bank is postponed during this interval. the number of trwl cycles can be specified by the trwl bit in mcr.
266 ckio csn rd/ wr ras cas dqmxx d31 to d0 bs address upper bits a12 or a10 address lower bits cke tr tc1 (trwl) (tpc) figure 10.27 basic timing for synchronous dram single write
267 refreshing: the bus state controller is provided with a function for controlling synchronous dram refreshing. auto-refreshing can be performed by clearing the rmode bit to 0 and setting the rfsh bit to 1 in mcr. if synchronous dram is not accessed for a long period, self-refresh mode, in which the power consumption for data retention is low, can be activated by setting both the rmode bit and the rfsh bit to 1. 1. auto-refreshing refreshing is performed at intervals determined by the input clock selected by bits cks2?ks0 in rtcsr, and the value set in rtcor. the value of bits cks2?ks0 in rtcor should be set so as to satisfy the refresh interval stipulation for the synchronous dram used. first make the settings for rtcor, rtcnt, and the rmode and rfsh bits in mcr, then make the cks2 to cks0 setting. when the clock is selected by cks2?ks0, rtcnt starts counting up from the value at that time. the rtcnt value is constantly compared with the rtcor value, and if the two values are the same, a refresh request is generated and an auto-refresh is performed. at the same time, rtcnt is cleared to zero and the count-up is restarted. figure 10.28 shows the auto refresh operation. figure 10.29 shows the auto-refresh cycle timing. first, an ref command is issued in the trr cycle. after the trr cycle, new command output cannot be performed for the duration of the number of cycles specified by the tras bits in mcr plus the number of cycles specified by the tpc bits in mcr. the tras and tpc bits must be set to satisfy the synchronous dram refresh cycle time stipulation (active/active command delay time). auto-refreshing is performed in normal operation, in sleep mode, and in a manual reset. rtcor value rtcnt h'00000000 rtcsr.cks(2?) cmf external bus cmf flag cleared by start of refresh cycle = 000 1 000 rtcnt cleared to 0 when rtcnt = rtcor auto-refresh cycle time figure 10.28 auto-refresh operation
268 ckio cke csn ras casxx rd/ wr trr trrw trrw (tpc) (tpc) figure 10.29 synchronous dram auto-refresh timing 2. self-refreshing self-refresh mode is a kind of standby mode in which the refresh timing and refresh addresses are generated within the synchronous dram. self-refreshing is activated by setting both the rmode bit and the rfsh bit to 1. the self-refresh state is maintained while the cke signal is low. synchronous dram cannot be accessed while in the self-refresh state. self-refresh mode is cleared by clearing the rmode bit to 0. after self-refresh mode has been cleared, command issuance is disabled for the number of cycles specified by the tpc bits in mcr. self-refresh timing is shown in figure 10.30. settings must be made so that self-refresh clearing and data retention are performed correctly, and auto-refreshing is performed at the correct intervals. when self-refreshing is activated from the state in which auto-refreshing is set, or when exiting standby mode other than through a power-on reset, auto-refreshing is restarted if rfsh is set to 1 and rmode is cleared to 0 when self-refresh mode is cleared. if the transition from clearing of self-refresh mode to the start of auto- refreshing takes time, this time should be taken into consideration when setting the initial value of rtcnt. making the rtcnt value 1 less than the rtcor value will enable refreshing to be started immediately. after self-refreshing has been set, the self-refresh state continues even if the chip standby state is entered using the sh7708 series? standby function, and is maintained even after recovery from standby mode other than through a power-on reset. for a power-on reset, the bus state controller? registers are initialized, thereby clearing the self-refresh state.
269 self-refreshing is performed in normal operation, in sleep mode, in standby mode, and in a manual reset. ckio cke csn ras casxx trs1 (trs2) (trs2) trs3 (tpc) (tpc) rd/ wr figure 10.30 synchronous dram self-refresh timing 3. relationship between refresh requests and bus cycle requests if a refresh request is generated during execution of a bus cycle, execution of the refresh is deferred until the bus cycle is completed. if a refresh request occurs when the bus has been released by the bus arbiter, refresh execution is deferred until the bus is acquired. if a match between rtcnt and rtcor occurs while a refresh is waiting to be executed, thereby generating a new refresh request, the previous refresh request is eliminated. to perform normal refreshing, ensure that no bus cycle or bus mastership occurs that is longer than the refresh interval. when a refresh request is generated, the irqout pin is asserted (driven low). therefore, normal refreshing can be performed by having the irqout pin monitored by a bus master other than the sh7708 series requesting the bus, or the bus arbiter, and returning the bus to the sh7708 series. when refreshing is started, and if no other interrupt request has been generated, the irqout pin is negated (driven high).
270 power-on sequence: in order to use synchronous dram, mode setting must first be performed after powering on. to perform synchronous dram initialization correctly, the bus state controller registers must first be set, followed by a write to the synchronous dram mode register. in synchronous dram mode register setting, the address signal value at that time is latched by a combination of the ras , cas , and rd/ wr signals. if the value to be set is x, the bus state controller provides for value x to be written to the synchronous dram mode register by performing a write to address h'ffffd000 + x for area 2 synchronous dram, and to address h'ffffe000 + x for area 3 synchronous dram. in this operation the data is ignored, but the mode write is performed as a byte-size access. to set burst read/write, cas latency 1 to 3, wrap type = sequential, and burst length 1 supported by the sh7708 series, arbitrary data is written in a byte-size access to the following addresses: area 2 area 3 cas latency 1 cas latency 2 cas latency 3 ffffd840 ffffd880 ffffd8c0 ffffe840 ffffe880 ffffe8c0 mode register setting timing is shown in figure 10.31. as a result of the write to address h'ffffd000 + x or h'ffffe000 + x, a precharge all banks (pall) command is first issued in the trp1 cycle, then a mode register write command is issued in the tmw1 cycle. before mode register setting, a 100 m s idle time (depending on the memory manufacturer) must be guaranteed after powering on requested by the synchronous dram. if the reset signal pulse width is greater than this idle time, there is no problem in performing mode register setting immediately. the number of dummy auto-refresh cycles specified by the manufacturer (usually 8) or more must be executed. this is usually achieved automatically through various initialization methods after auto-refresh setting. however, a more dependable method is to set a short refresh request generation interval just as these dummy cycles are being executed. with simple read or write access, the address counter in the synchronous dram used for auto-refreshing is not initialized, and so the cycle must always be an auto-refresh cycle.
271 ckio a13 or a11 a12 or a10 a11 to a2, or a9 to a2 csn rd/ wr ras casxx d31 to d0 cke trp1 trp2 trp3 trp4 tmw1 tmw2 tmw3 tmw4 (high) figure 10.31 synchronous dram mode write timing
272 10.3.6 pseudo-sram direct connection when the memory type bits (dramtp2-0) in bcr1 are set to 001, physical space area 3 becomes pseudo-sram and the pseudo-sram interface function that allows pseudo-sram to be connected directly to the sh7708 series can be used. an interface data width of 16 or 32 bits can be selected. with directly connected pseudo-sram, the refresh signal and output enable signal are multiplexed. the signals used for connection are ce , oe / rfsh , we3 , we2 , we1 , and we0 . we3 and we2 are not used with a 16-bit data width. as access modes, burst access using the static column access function is supported in addition to ordinary read/write access. figure 10.32 shows an example of connection of 4m pseudo-srams with multiplexed oe and rfsh signals, using a 32-bit data width.
273 a18 a0 ce oe / rfsh i/o7 i/o0 we a20 a2 ce oe d31 d24 we3 d23 d16 we2 d15 d8 we1 d7 d0 we0 sh7708 series 512k 8-bit pseudo-sram a18 a0 ce oe / rfsh i/o7 i/o0 we a18 a0 ce oe / rfsh i/o7 i/o0 we a18 a0 ce oe / rfsh i/o7 i/o0 we figure 10.32 example of pseudo-sram connection (4m-bit devices)
274 basic timing: figure 10.33 shows the basic timing for pseudo-sram. tpc is the precharge cycle, and tr is the ce assert cycle. tc1 is the write data cycle, bs the assert cycle, and tc2 the read data latch cycle. tr tc1 tc2 (tpc) ckio a25 to a0 ce rd/ wr oe / rfsh (read) d31 to d0 (read) d31 to d0 (write) wen (write) bs figure 10.33 basic access timing for pseudo-sram
275 wait state control: as the clock frequency increases, it becomes impossible to complete all states in one cycle as in basic access. therefore, provision is made for state extension by using the setting bits in wcr2 and mcr. the timing with state extension using these settings is shown in figure 10.34. additional tpc cycles (cycles used to secure the ce precharge time) can be inserted by means of the tpc bits in mcr. the number of oe and wen assert cycles from ras assertion to cas assertion can be varied between 1 and 3 according to the setting of a3w1 and a3w0 in wcr2. trw cycles can be inserted by means of the rcd bits in mcr, and the number of cycles from ce assertion to bs assertion and write data output can be varied between 1 and 4.
276 ckio tr a25 to a0 ce rd/ wr oe / rfsh (read) d31 to d0 (read) d31 to d0 (write) wen (write) bs trw tc1 tc1w tc1w tc2 (tpc) figure 10.34 pseudo-sram wait state timing burst access: in addition to the normal access mode in which ce is asserted and negated in each access, some pseudo-srams are provided with a static column mode for the case where consecutive accesses are made to the same row address. this mode allows fast access to data by keeping ce asserted and changing only the column address. normal access or burst access using static column mode can be selected by means of the burst enable (be) bit in mcr. the timing for burst access in static column mode is shown in figure 10.35. cycles can also be inserted by the wait state control function when burst access is performed.
277 ckio tr a25 to a4 a3 to a0 ce rd/ wr oe / rfsh (read) d31 to d0 (read) d31 to d0 (write) wen (write) bs tc1 tc2 tc1 tc2 tc1 tc2 tc1 tc2 (tpc) figure 10.35 pseudo-sram static column mode
278 refreshing: the bus state controller includes a function for controlling pseudo-sram refreshing. distributed refreshing by means of auto-refresh cycles can be performed by clearing the rmode bit to 0 and setting the rfsh bit to 1 in mcr. refreshing is performed at intervals determined by the input clock selected by bits cks2?ks0 in rtcsr, and the value set in rtcor. the value of bits cks2?ks0 in rtcor should be set so as to satisfy the refresh interval stipulation for the pseudo-sram used. first set the rtcor, rtcnt, and the rmode and rfsh bits in mcr, then set the cks2?ks0. when the clock is selected by cks2?ks0, rtcnt starts counting up from the value at that time. the rtcnt value is constantly compared with the rtcor value, and if the two values are the same, a refresh request is generated and an auto-refresh is performed. at the same time, rtcnt is cleared to zero and the count-up is restarted. figure 10.36 shows the auto-refresh cycle timing. the number of oe assert cycles for auto-refreshing is specified by the tras bits in mcr. the precharge time from oe negation until the next assertion of ce is determined by the setting of the tpc bits in mcr. auto-refreshing is performed in normal operation, in sleep mode, and in a manual reset. ckio trc ce oe / rfsh trr1 trr2 (tpc) figure 10.36 pseudo-sram auto-refreshing
279 with pseudo-sram, self-refresh mode is entered by holding the rfsh signal low for at least the prescribed time. self-refreshing is activated by setting both the rmode bit and the rfsh bit to 1. the self-refresh state is maintained while the cke signal is low. pseudo-sram cannot be accessed while in self-refresh state. self-refresh mode is cleared by clearing the rmode bit to 0. after self-refresh mode has been cleared, access to pseudo-sram is disabled for the number of cycles specified by the tpc bits in mcr, but if the refresh reset time needed to return from self- refreshing is longer than this interval, coding must be provided to ensure that no access?ncluding auto-refresh?s made to pseudo-sram. self-refresh timing is shown in figure 10.37. settings must be made so that self-refresh clearing and data retention is performed correctly after self-refresh mode is cleared, and auto-refreshing is performed at the correct intervals. if the transition from clearing of self-refresh mode to the start of auto-refreshing takes time, this time should be taken into consideration when setting the initial value of rtcnt. self-refreshing is performed in normal operation, in sleep mode, in standby mode, and in a manual reset. ckio trc ce oe / rfsh trr1 tsr tsr2 (tpc) (tpc) (high) figure 10.37 pseudo-sram self-refreshing power-on sequence: after powering pseudo-sram on, a minimum wait time of 100 m s is requested during which no access can be performed, followed by the prescribed number (usually 8 or more) of dummy auto-refresh cycles. as the bus state controller does not perform any special operations for a power-on reset, the power-on sequence must be carried out by the initialization program executed after a power-on reset.
280 10.3.7 burst rom interface setting bits a0bst (1,0), a5bst (1,0), and a6bst (1,0) in bcr1 to a non-zero value allows burst rom to be connected to areas 0, 5, and 6. the burst rom interface provides high-speed access to rom that has a nibble access function. the timing for nibble access to burst rom is shown in figure 10.38. two wait cycles are set. basically, access is performed in the same way as for normal space, but when the first cycle ends, the cs0 signal is not negated, and only the address is changed before the next access is executed. when 8-bit rom is connected, the number of consecutive accesses can be set as 4, 8, or 16 by bits a0bst (1,0), a5bst (1,0), or a6bst (1,0). when 16-bit rom is connected, 4 or 8 can be set in the same way. when 32-bit rom is connected, only 4 can be set. wait pin sampling is performed in the first access if one or more wait states are set, and is always performed in the second and subsequent accesses. wait is a synchronous signal. the second and subsequent access cycles also comprise two cycles when a burst rom setting is made and the wait specification is 0. the timing in this case is shown in figure 10.39.
281 t1 tw tw tb2 tb1 tw tb2 ckio a25 to a4 a3 to a0 csn rd/ we rd d31 to d0 bs wait t2 note: for a write cycle, a basic bus cycle (write cycle) is performed. t2 figure 10.38 burst rom wait access timing
282 t1 tb2 tb1 tb2 tb1 tb2 tb1 t2 ckio a25 to a4 a3 to a0 csn rd/ we rd d31 to d0 bs wait note: for a write cycle, a basic bus cycle (write cycle) is performed. figure 10.39 burst rom basic access timing
283 10.3.8 pcmcia interface in the sh7708 series, setting the a5pcm bit in bcr1 to 1 makes the bus interface for physical space area 5 an ic memory card interface as stipulated in jeida version 4.2 (pcmcia2.1). setting the a6pcm bit to 1 makes the bus interface for physical space area 6 an ic memory card and i/o card interface as stipulated in jeida version 4.2. when the ic memory card interface is selected, a bcr1 register setting enables page mode burst access mode to be used. this burst access mode is not stipulated in jeida version 4.2, but allows high-speed data access using rom provided with a burst mode, etc. when the pcmcia interface is used, a bus size of 8 or 16 bits can be set by bits a5sz1 and a5sz0, or a6sz1 and a6sz0, in bcr2. figure 10.40 shows an example of pcmcia card connection to the sh7708 series. to enable active insertion of the pcmcia cards (i.e. insertion or removal while system power is being supplied), a 3-state buffer must be connected between the sh7708 series? bus interface and the pcmcia cards. as operation in big-endian mode is not explicitly stipulated in the jeida/pcmcia specifications, the pcmcia interface for the sh7708 series in big-endian mode is stipulated independently. if pcmcia is used in area 6, synchronous dram is used at the same time, and a synchronous dram auto-refresh (cas-before-ras refresh) request is issued simultaneously, area 6 card enable signals cs6 and ce2b may be asserted earlier than usual, at the same time as the immediately preceding auto-refresh cycle. when both pcmcia and synchronous dram are used, they should be used in area 5. when area 5 is used, the system design should provide for cs to be asserted early without causing any problems.
284 a24 to a0 d15 to d0 rd/ wr ce1b /( cs6 ) ce1a /( cs5 ) rd we1 iciord iciowr wait iois16 sh7708 series a25 to a0 d15 to d0 ce2 oe we / pgm ( iord ) ( iowr ) wait ( iois16 ) cd1, cd2 ce1 pc card (memory/io) g g g dir dir g d7 to d0 d15 to d8 a25 to a0 d15 to d0 ce2 oe we / pgm wait cd1, cd2 ce1 pc card (memory/io) g g g dir dir g d7 to d0 d15 to d8 ce2b ce2a output port card detection circuit card detection circuit figure 10.40 example of pcmcia interface
285 memory card interface basic timing: figure 10.41 shows the basic timing for the pcmcia ic memory card interface. when physical space areas 5 and 6 are designated as pcmcia interface areas, bus accesses are automatically performed as ic memory card interface accesses when the lower address 32 mbyte space of each area is accessed. with a high external bus frequency (ckio), the setup and hold times for the address (a24?0), card enable ( cs5 , ce2a , cs6 , ce2b ), and write data (d15?0) in a write cycle, become insufficient with respect to rd and wr (the we1 pin in the sh7708 series). the sh7708 series provides for this by enabling setup and hold times to be set for physical space areas 5 and 6 in the pcr register. also, software waits by means of a wcr2 register setting and hardware waits by means of the wait pin can be inserted in the same way as for the basic interface. wait is a synchronous signal. figure 10.42 shows the pcmcia memory bus wait timing.
286 ckio tpcm1 tpcm2 a25 to a0 cexx rd/ wr d15 to d0 (read) d15 to d0 (read) rd (read) we1 (write) bs figure 10.41 basic timing for pcmcia memory card interface
287 ckio tpcm0 a25 to a0 rd/ wr cexx rd (read) d15 to d0 (read) d15 to d0 (write) we1 (write) bs wait tpcm0w tpcm1 tpcm1w tpcm1w tpcm2 tpcm2w figure 10.42 wait timing for pcmcia memory card interface
288 memory card interface burst timing: in the sh7708 series, when the ic memory card interface is selected, page mode burst access mode can be used, for read access only, by setting bits a5bst1 and a5bst0 in bcr for physical space area 5, or bits a6bst1 and a6bst0 for area 6. this burst access mode is not stipulated in jeida version 4.2 (pcmcia2.1), but allows high- speed data access using rom provided with a burst mode, etc. burst access mode timing is shown in figures 10.43 and 10.44. ckio tpcm1 a25 to a4 cexx a3 to a0 rd/ wr rd (read) d15 to d0 (read) bs tpcm2 tpcm1 tpcm2 tpcm1 tpcm2 tpcm1 tpcm2 figure 10.43 basic timing for pcmcia memory card interface burst access
289 ckio tpcm0 a25 to a4 cexx a3 to a0 rd/ wr rd (read) d15 to d0 (read) bs wait tpcm1 tpcm1w tpcm1w tpcm1w tpcm2 tpcm1 tpcm1w tpcm2 tpcm2w figure 10.44 wait timing for pcmcia memory card interface burst access when the entire 32-mbyte memory space is used as ic memory card interface space, the common memory/attribute memory switching signal reg is generated using a port, etc. if 16-mbytes or less of memory space is sufficient, using 16m bytes of memory space as common memory space and 16 mbytes as attribute memory space enables the a24 pin to be used for the reg signal.
290 i/o space area 5: h'14000000 area 5: h'16000000 area 6: h'18000000 area 6: h'1a000000 area 5: h'14000000 area 5: h'15000000 h'16000000 area 6: h'18000000 area 6: h'19000000 area 6: h'1a000000 h'1b000000 attribute memory common memory attribute memory common memory i/o space up to 16-mbyte capacity (reg = a24) 32-mbyte capacity (reg = i/o port) common memory/ attribute memory common memory/ attribute memory figure 10.45 pcmcia space allocation i/o card interface timing: figures 10.46 and 10.47 show the timing for the pcmcia i/o card interface. the i/o card interface is supported only for physical space area 6. switching between the i/o card interface and the ic memory card interface is performed according to the accessed address. when pcmcia is designated for physical space area 6, the bus access is automatically performed as an i/o card interface access when a physical address from h'1a000000 to h'1bffffff is accessed. when accessing a pcmcia i/o card, the access should be performed using a noncacheable area in virtual space (p2 or p3 space) or an area specified as noncacheable by the mmu. when an i/o card interface access is made to a pcmcia card in little-endian mode, dynamic sizing of the i/o bus width is possible using the iois16 pin. when a 16-bit bus width is set for area 6, if the iois16 signal is high during a word-size i/o bus cycle, the i/o port is recognized as being 8 bits in width. in this case, a data access for only 8 bits is performed in the i/o bus cycle being executed, followed automatically by a data access for the remaining 8 bits.
291 figure 10.48 shows the basic timing for dynamic bus sizing. in big-endian mode, the iois16 signal is not supported. in big-endian mode, the iois16 signal should be fixed low.
292 ckio tpci1 tpci2 a25 to a0 rd/ wr cexx iciord (read) d15 to d0 (read) iciowr (write) d15 to d0 (write) bs figure 10.46 basic timing for pcmcia i/o card interface
293 ckio a25 to a0 rd/ wr cexx iciord (read) iciowr (write) d15 to d0 (read) d15 to d0 (write) bs wait iois16 tpci0 tpci0w tpci1 tpci1w tpci1w tpci2 tpci2w figure 10.47 wait timing for pcmcia i/o card interface
294 ckio tpci0 a25 to a1 cexx a0 rd/ wr iciord (read) d15 to d0 (read) iciowr (write) d15 to d0 (write) bs wait iois16 tpci1 tpci1w tpci2 tpci1 tpci1w tpci2 tpci2w figure 10.48 dynamic bus sizing timing for pcmcia i/o card interface
295 10.3.9 waits between access cycles a problem associated with higher external memory bus operating frequencies is that data buffer turn-off on completion of a read from a low-speed device may be too slow, causing a collision with data in the next access. this results in lower reliability or incorrect operation. to avoid this problem, a data collision prevention feature has been provided. this memorizes the preceding access area and the kind of read/write. if there is a possibility of a bus collision when the next access is started, a wait cycle is inserted before the access cycle thus preventing a data collision. there are two cases in which a wait cycle is inserted: when an access is followed by an access to a different area, and when a read access is followed by a write access from the sh7708 series. when the sh7708 series performs consecutive write cycles, the data transfer direction is fixed (from the sh7708 series to other memory) and there is no problem. with read accesses to the same area, in principle, data is output from the same data buffer, and wait cycle insertion is not performed. bits aniw1 and aniw0 (n = 0?) in wcr1 specify the number of idle cycles to be inserted between access cycles when a physical space area access is followed by an access to another area, or when the sh7708 series performs a write access after a read access to physical space area n. if there is originally space between accesses, the number of idle cycles inserted is the specified number of idle cycles minus the number of empty cycles. waits are not inserted between accesses when bus arbitration is performed, since empty cycles are inserted for arbitration purposes. t1 ckio csm csn a25 to a0 bs rd/ wr rd d31 to d0 t2 twait t1 t2 twait t1 t2 area m read area m inter-access wait specification area n inter-access wait specification area n space read area n space write figure 10.49 waits between access cycles
296 10.3.10 bus arbitration when a bus release request ( breq ) is received from an external device, buses are released after the bus cycle being executed is completed and a bus grant signal ( back ) is output. the bus is not released during burst transfers for cache fills. in the case of multiple bus cycles generated because the data bus width is smaller than the access size?or example, in longword access to 8-bit-wide memory?us arbitration is not performed between bus cycles. at the negation of breq , back is negated and bus use is restarted. see appendix b, pin states, for the pin status when the bus is released. the sh7708 series sometimes needs to retrieve a bus it has released. for example, when memory generates a refresh request or an interrupt request internally, the sh7708 series must perform the appropriate processing. the sh7708 series has a bus request signal ( irqout ) for this purpose. when it must retrieve the bus, it asserts the irqout signal. devices asserting an external bus release request receive the assertion of the irqout signal and negate the breq signal to release the bus. the sh7708 series retrieves the bus and carries out the processing. irqout pin assertion conditions: when a memory refresh request has been generated but the refresh cycle has not yet begun when an interrupt is generated with an interrupt request level higher than the setting of the interrupt mask bits (i3?0) in the status register (sr). (this does not depend on the sr.bl bit.)
297 section 11 timer (tmu) 11.1 overview the sh7708 series uses a three-channel 32-bit timer unit (tmu). 11.1.1 features the tmu has the following features: ? each channel is provided with an auto-reload 32-bit down counter ? channel 2 is provided with an input capture function ? all channels are provided with 32-bit constant registers and 32-bit down counters that can be read or written to at any time ? all channels generate interrupt requests when the 32-bit down counter underflows (h'00000000 h'ffffffff) ? allows selection between 6 counter input clocks: external clock (tclk), on-chip rtc output clock (16 khz), p f /4, p f /16, p f /64, p f /256. (p f is the internal clock for peripheral modules and can be selected as 1/4, 1/2, or the same frequency as that of the cpu operating clock f .) see section 9, on-chip oscillation circuits, for more information on the clock pulse generator. ? all channels can operate when the sh7708 series is in standby mode: when the rtc output clock is being used as the counter input clock, the sh7708 series is still able to count in standby mode. ? synchronized read: tcnt is a sequentially changing 32-bit register. since the peripheral module used has an internal bus width of 16 bits, a time lag can occur between the time when the upper 16 bits and lower 16 bits are read. to correct the discrepancy in the counter read value caused by this time lag, a synchronization circuit is built into the tcnt so that the entire 32- bit data in the tcnt can be read at once. ? the maximum operating frequency of the 32-bit counter is 2 mhz on all channels: operate the sh7708 series so that the clock input to the timer counters of each channel (obtained by dividing the external clock and internal clock with the prescaler) does not exceed the maximum operating frequency. 11.1.2 block diagram figure 11.1 shows a block diagram of the tmu.
298 tocr prescaler tstr tcr0 tcnt0 module bus internal bus tcor0 tcr1 tcnt1 tcor1 counter controller tclk p f rtcclk tuni0 bus interface ch. 0 interrupt controller interrupt controller interrupt controller counter controller counter controller tuni1 tuni2 ticpi2 tcr2 tcpr2 tcnt2 tcor2 tmu ch. 1 ch. 2 clock controller tocr: tstr: tcr: timer output control register timer start register tcnt: tcor: tcpr2: 32-bit timer counter 32-bit timer constant register 32-bit input capture register timer control register figure 11.1 tmu block diagram
299 11.1.3 pin configuration table 11.1 shows the pin configuration of the tmu. table 11.1pin configuration channel pin i / o description clock input/clock output tclk i/o external clock input pin/input capture control input pin/realtime clock (rtc) output pin 11.1.4 register configuration table 11.2 shows the tmu register configuration. table 11.2tmu register configuration channel register abbreviationr/w initial value* address acces s size common timer output control register tocr r/w h'00 h'fffffe90 8 timer start register tstr r/w h'00 h'fffffe92 8 0 timer constant register 0 tcor0 r/w h'ffffffff h'fffffe94 32 timer counter 0 tcnt0 r/w h'ffffffff h'fffffe98 32 timer control register 0 tcr0 r/w h'0000 h'fffffe9c 16 1 timer constant register 1 tcor1 r/w h'ffffffff h'fffffea0 32 timer counter 1 tcnt1 r/w h'ffffffff h'fffffea4 32 timer control register 1 tcr1 r/w h'0000 h'fffffea8 16 2 timer constant register 2 tcor2 r/w h'ffffffff h'fffffeac 32 timer counter 2 tcnt2 r/w h'ffffffff h'fffffeb0 32 timer control register 2 tcr2 r/w h'0000 h'fffffeb4 16 input capture register 2 tcpr2 r/w undefined h'fffffeb8 32 note: initialized by a power-on reset or manual reset.
300 11.2 tmu registers 11.2.1 timer output control register (tocr) tocr is an 8-bit read/write register that selects whether to use the external tclk pin as an external clock or an input capture control usage input pin, or an output pin for the on-chip rtc output clock. tocr is initialized to h'00 by a power-on reset or manual reset, but is not initialized in standby mode, and its contents are retained. bit: 7 6 5 4 3 2 1 0 bit name: tcoe initial value: 0 0 0 0 0 0 0 0 r/w: r r r r r r r r/w bits 7 to 1?eserved: these bits always read 0. the write value should always be 0. bit 0?imer clock pin control (tcoe): selects use of the timer clock pin (tclk) as an external clock input pin or input pin for input capture control for the on-chip timer, or as an output pin for the on-chip rtc output clock. bit 0: tcoe description 0 timer clock pin (tclk) used as external clock input or input capture control input pin for the on-chip timer (initial value) 1 timer clock pin (tclk) used as output pin for on-chip rtc output clock
301 11.2.2 timer start register (tstr) tstr is an 8-bit read/write register that selects whether to run or halt the timer counters (tcnt) for channels 0?. tstr is initialized to h'00 by a power-on reset or manual reset. in standby mode, when the pll1 multiplication factor is changed in clock mode 0, 1, 2, or 7, or when the mstp2 bit is set to 1 in stbcr, tstr is initialized only when the input clock selected for the channel is an external clock (tclk) or the peripheral clock (p?. bit: 7 6 5 4 3 2 1 0 bit name: str2 str1 str0 initial value: 0 0 0 0 0 0 0 0 r/w: r r r r r r/w r/w r/w bits 7 to 3?eserved: these bits always read 0. the write value should always be 0. bit 2?ounter start 2 (str2): selects whether to run or halt timer counter 2 (tcnt2). bit 2: str2 description 0 halt tcnt2 count (initial value) 1 start tcnt2 counting bit 1?ounter start 1 (str1): selects whether to run or halt timer counter 1 (tcnt1). bit 1: str1 description 0 halt tcnt1 count (initial value) 1 start tcnt1 counting bit 0?ounter start 0 (str0): selects whether to run or halt timer counter 0 (tcnt0). bit 0: str0 description 0 halt tcnt0 count (initial value) 1 start tcnt0 counting
302 11.2.3 timer control register (tcr) the timer control registers (tcr) control the timer counters (tcnt) and interrupts. the tmu has three tcr, registers one for each channel. the tcr registers are 16-bit read/write registers that control the issuance of interrupts when the flag indicating timer counter (tcnt) underflow has been set to 1, and also carry out counter clock selection. when the external clock has been selected, they also select its edge. additionally, tcr2 controls the channel 2 input capture function and the issuance of interrupts during input capture. the tcrs are initialized to h'0000 by a power-on reset and manual reset. in standby mode, when the pll1 multiplication factor is changed in clock mode 0, 1, 2, or 7, or when the mstp2 bit is set to 1 in stbcr, the tcrs retain their contents when the input clock selected for the channel is an external clock (tclk) or the peripheral clock (p?, and continue operating when the selected clock is the on-chip rtc output clock (rtcclk). channel 0 and 1 tcr bit configuration: bit: 15 14 13 12 11 10 9 8 bit name: unf initial value: 0 0 0 0 0 0 0 0 r/w: r r r r r r r r/w bit: 7 6 5 4 3 2 1 0 bit name: unie ckeg1 ckeg0 tpsc2 tpsc1 tpsc0 initial value: 0 0 0 0 0 0 0 0 r/w: r r r/w r/w r/w r/w r/w r/w channel 2 tcr bit configuration: bit: 15 14 13 12 11 10 9 8 bit name: icpf unf initial value: 0 0 0 0 0 0 0 0 r/w: r r r r r r r/w r/w bit: 7 6 5 4 3 2 1 0 bit name: icpe1 icpe0 unie ckeg1 ckeg0 tpsc2 tpsc1 tpsc0 initial value: 0 0 0 0 0 0 0 0 r/w: r/w r/w r/w r/w r/w r/w r/w r/w
303 bits 15 to 10, 9 (except tcr2), 7, and 6 (except tcr2)?eserved: these bits always read 0. the write value should always be 0. bit 9?nput capture interrupt flag (icpf): a function of channel 2 only: the flag is set when input capture is requested via the tclk pin. bit 9: icpf description 0 no input capture request has been issued. clearing condition: when 0 is written to icpf (initial value) 1 input capture has been requested via the tclk pin. setting condition: when an input capture is requested via the tclk pin* note: contents do not change when 1 is written to icpf. bit 8?nderflow flag (unf): status flag that indicates occurrence of a tcnt underflow. bit 8: unf description 0 tcnt has not underflowed. clearing condition: when 0 is written to unf (initial value) 1 tcnt has underflowed (h'00000000 h'ffffffff). setting condition: when tcnt underflows* note: contents do not change when 1 is written to unf. bits 7 and 6?nput capture control (icpe1, icpe0): a function of channel 2 only: determines whether the input capture function can be used, and when used, whether or not to enable interrupts. when using this input capture function it is necessary to set the tclk pin to input mode with the tcoe bit in the tocr register. additionally, use the ckeg bit to designate use of either the rising or falling edge of the tclk pin to set the value in tnct2 in the input capture register (tcpr2). bit 7: icpe1 bit 6: icpe0 description 0 0 input capture function is not used. (initial value) 1 reserved (cannot be set) 1 0 input capture function is used. interrupts due to icpf (ticpi2) are not enabled. 1 input capture function is used. interrupts due to icpf (ticpi2) are enabled.
304 bit 5?nderflow interrupt control (unie): controls enabling of interrupt generation when the status flag (unf) indicating tcnt underflow has been set to 1. bit 5: unie description 0 interrupts due to unf (tuni) are not enabled. (initial value) 1 interrupts due to unf (tuni) are enabled. bits 4 and 3?lock edge 1, 0 (ckeg1, ckeg0): these bits select the external clock edge when the external clock is selected, or when the input capture function is used. bit 4: ckeg1 bit 3: ckeg0 description 0 0 count/capture register set on rising edge (initial value) 1 count/capture register set on falling edge 1 count/capture register set on both rising and falling edge bits 2 to 0?imer prescalers 2? (tpsc2?psc0): these bits select the tcnt count clock. bit 2: tpsc2 bit 1: tpsc1 bit 0: tpsc0 description 0 0 0 internal clock: count on p f /4 (initial value) 1 internal clock: count on p f /16 1 0 internal clock: count on p f /64 1 internal clock: count on p f /256 1 0 0 internal clock: count on clock output of on-chip rtc (rtcclk) 1 external clock: count on tclk pin input 1 0 reserved ( do not set) 1 reserved (do not set)
305 11.2.4 timer constant register (tcor) the timer constant registers are 32-bit registers. the tmu has three tcor registers, one for each of the three channels. tcor is a 32-bit read/write register. when a tcnt count-down results in an underflow, the tcor value is set in tcnt and the count-down continues from that value. tcor is initialized to h'ffffffff by a power-on reset or manual reset; it is not initialized in standby mode, and retains its contents. tcor: bit: 31 30 29 28 27 26 25 24 bit name: initial value: 1 1 1 1 1 1 1 1 r/w: r/w r/w r/w r/w r/w r/w r/w r/w bit: 23 22 21 20 19 18 17 16 bit name: initial value: 1 1 1 1 1 1 1 1 r/w: r/w r/w r/w r/w r/w r/w r/w r/w bit: 15 14 13 12 11 10 9 8 bit name: initial value: 1 1 1 1 1 1 1 1 r/w: r/w r/w r/w r/w r/w r/w r/w r/w bit: 7 6 5 4 3 2 1 0 bit name: initial value: 1 1 1 1 1 1 1 1 r/w: r/w r/w r/w r/w r/w r/w r/w r/w
306 11.2.5 timer counters (tcnt) the timer counters are 32-bit read/write registers. the tmu has three timer counters, one for each channel. tcnt counts down upon input of a clock. the clock input is selected using the tpsc2?psc0 bits in the timer control register (tcr). when a tcnt count-down results in an underflow (h'00000000 h'ffffffff), the underflow flag (unf) in the timer control register (tcr) of the relevant channel is set. the tcor value is simultaneously set in tcnt itself and the count-down continues from that value. because the internal bus for the sh7708 series on-chip supporting modules is 16 bits wide, a time lag can occur between the time when the upper 16 bits and lower 16 bits are read. since tcnt counts sequentially, this time lag can create discrepancies between the data in the upper and lower halves. to correct the discrepancy, a buffer register is connected to tcnt so that upper and lower halves are not read separately. the entire 32-bit data in tcnt can thus be read at once. tcnt is initialized to h'ffffffff by a power-on reset or manual reset. in standby mode, when the pll1 multiplication factor is changed in clock mode 0, 1, 2, or 7, or when the mstp2 bit is set to 1 in stbcr, tcnt retains its contents when the input clock selected for the channel is an external clock (tclk) or the peripheral clock (p?, and continues operating when the selected clock is the on-chip rtc output clock (rtcclk). tcnt: bit: 31 30 29 28 27 26 25 24 bit name: initial value: 1 1 1 1 1 1 1 1 r/w: r/w r/w r/w r/w r/w r/w r/w r/w bit: 23 22 21 20 19 18 17 16 bit name: initial value: 1 1 1 1 1 1 1 1 r/w: r/w r/w r/w r/w r/w r/w r/w r/w bit: 15 14 13 12 11 10 9 8 bit name: initial value: 1 1 1 1 1 1 1 1 r/w: r/w r/w r/w r/w r/w r/w r/w r/w
307 bit: 7 6 5 4 3 2 1 0 bit name: initial value: 1 1 1 1 1 1 1 1 r/w: r/w r/w r/w r/w r/w r/w r/w r/w 11.2.6 input capture register (tcpr2) the input capture register (tcpr2) is a read-only 32-bit register built only into timer 2. control of tcpr2 setting conditions due to the tclk pin is affected by the input capture function bits (icpe1/icpe2 and ckeg1/ckeg0)) in tcr2. when a tcpr2 setting indication due to the tclk pin occurs, the value of tcnt2 is copied into tcpr2. tcnt2 is not initialized by a power-on reset or manual reset, or in standby mode. tcpr2: bit: 31 30 29 28 27 26 25 24 bit name: initial value: r/w: r r r r r r r r bit: 23 22 21 20 19 18 17 16 bit name: initial value: r/w: r r r r r r r r bit: 15 14 13 12 11 10 9 8 bit name: initial value: r/w: r r r r r r r r bit: 7 6 5 4 3 2 1 0 bit name: initial value: r/w: r r r r r r r r
308 11.3 tmu operation 11.3.1 overview each of the three channels has a 32-bit timer counter (tcnt) and a 32-bit timer constant register. the tcnt counts down. the auto-reload function enables synchronized counting and counting by external events. channel 2 has an input capture function. 11.3.2 basic functions counter operation: when the str0?tr2 bits in the timer start register (tstr) are set, the corresponding timer counter (tcnt) starts counting. when a tcnt underflows (h'00000000 h'ffffffff), the unf flag of the corresponding timer control register (tcr) is set. at this time, if the unie bit in tcr is 1, an interrupt request is sent to the cpu. also at this time, the value is copied from tcor to tcnt and the down-count operation is continued. the count operation is set as follows (figure 11.2): 1. select the counter clock with the tpsc2?psc0 bits in the timer control register (tcr). if the external clock is selected, set the tclk pin to input mode with the toce bit in tocr, and select its edge with the ckeg1 and ckeg0 bits in tcr. 2. use the unie bit in tcr to set whether to generate an interrupt when tcnt underflows. 3. when using the input capture function, set the icpe bits in tcr, including the choice of whether or not to use the interrupt function (channel 2 only). 4. set a value in the timer constant register (tcor) (the cycle is the set value plus 1). 5. set the initial value in the timer counter (tcnt). 6. set the str bit in the timer start register (tstr) to 1 to start operation.
309 operation selection select counter clock set underflow interrupt generation set timer constant register initialize timer counter start counting (1) (2) (4) (5) (6) set interrupt generation when using input capture function (3) note: when an interrupt has been generated, clear the flag in the interrupt handler that caused it. if interrupts are enabled without clearing the flag, another interrupt will be generated. figure 11.2 setting the count operation
310 auto-reload count operation: figure 11.3 shows the tcnt auto-reload operation. tcnt value tcor h'00000000 str0?tr2 unf tcor value set to tcnt during underflow time figure 11.3 auto-reload count operation tcnt count timing: ? internal clock operation: set the tpsc2?psc0 bits in tcr to select whether peripheral module clock p f or one of the four internal clocks created by dividing it is used (p f /4, p f /16, p f /64, p f /256). figure 11.4 shows the timing. p f internal clock tcnt input clock tcnt n + 1 n n ?1 figure 11.4 count timing when internal clock is operating ? external clock operation: set the tpsc2?psc0 bits in tcr to select the external clock (tclk) as the timer clock. use the ckeg1 and ckeg0 bits in tcr to select the detection edge. rise, fall or both may be selected. the pulse width of the external clock must be at least 1.5 peripheral module clock cycles for single edges or 2.5 peripheral module clock cycles for both edges. a shorter pulse width will result in inaccurate operation. figure 11.5 shows the timing for both-edge detection.
311 p f external clock input pin tcnt input clock tcnt n + 1 n n ?1 figure 11.5 count timing when external clock is operating (both edges detected) ? on-chip rtc clock operation: set the tpsc2?psc0 bits in tcr to select the on-chip rtc clock as the timer clock. figure 11.6 shows the timing. rtc output clock tcnt tcnt input clock n + 1 n n ?1 figure 11.6 count timing when on-chip rtc clock is operating input capture function: channel 2 has an input capture function (figure 11.7). when using the input capture function, set the tclk pin to input mode with the tcoe bit in the timer output control register (tocr) and set the timer operation clock to internal clock or on-chip rtc clock with the tpcs2?pcs0 bits in the timer control register (tcr). also, designate use of the input capture function and whether to generate interrupts on using it with the ipce1?pce0 bits in tcr, and designate the use of either the rising or falling edge of the tclk pin to set the timer counter (tnct) value into the input capture register (tcpr) with the ckeg1?keg0 bits in tcr. the input capture function cannot be used in standby mode.
312 tcnt value tcor h'00000000 tclk tcpr2 set tcnt value icpi tcor value set to tcnt during underflow time figure 11.7 operation timing when using the input capture function (usingtclkrising edge) 11.4 interrupts there are two sources of tmu interrupts: underflow interrupts (tuni) and interrupts when using the input capture function (ticpi2). 11.4.1 status flag set timing unf is set to 1 when the tcnt underflows (h'00000000 h'ffffffff). figure 11.8 shows the timing. p f tcnt underflow signal unf tuni tcor value h'00000000 figure 11.8 unf set timing
313 11.4.2 status flag clear timing the status flag can be cleared by writing a 0 from the cpu. figure 11.9 shows the timing. p f peripheral address bus unf, icpf tcr address t1 t2 tcr write cycle t3 figure 11.9 status flag clear timing 11.4.3 interrupt sources and priorities the tmu produces underflow interrupts for each channel. when the interrupt request flag and interrupt enable bit are both set to 1, the interrupt is requested. codes are set in the exception source register (intevt) for these interrupts and interrupt handling occurs according to the codes. the relative priorities of channels can be changed using the interrupt controller (see section 6, interrupt controller) and section 4, exception handling. table 11.3 lists tmu interrupt sources. table 11.3 tmu interrupt sources channel interrupt source description priority 0 tuni0 underflow interrupt 0 high 1 tuni1 underflow interrupt 1 2 tuni2 underflow interrupt 2 2 ticpi2 input capture interrupt 2 low
314 11.5 usage notes 11.5.1 writing to registers synchronization processing is not performed for timer counting during register writes. when writing to registers, always clear the appropriate start bits for the channel (str2?tr0) in the timer start register (tstr) to halt timer counting. 11.5.2 reading registers synchronization processing is performed for timer counting during register reads. when timer counting and register read processing are performed simultaneously, the register value before tcnt counting down (with synchronization processing) is read. 11.5.3 clearing unf in the tcr register when the rtc (realtime clock) is specified for use as the tmu (timer) clock source in the sh7708, the procedure shown in the flowchart below should be used to clear the underflow flag (unf) in the timer control register (tcr). no yes clear unf flag read unf flag unf = 0? figure 11.10 unf flag clearing
315 section 12 realtime clock (rtc) 12.1 overview the sh7708 series has a realtime clock (rtc) with its own 32.768-khz crystal oscillator. 12.1.1 features ? clock and calendar functions (bcd display): seconds, minutes, hours, date, day of the week, month, and year ? 1-hz to 64-hz timer (binary display) ? start/stop function ? 30-second adjust function ? alarm interrupt: frame comparison of seconds, minutes, hours, date, day of the week, and month can be used as conditions for the alarm interrupt ? cyclic interrupts: the interrupt cycle may be 1/256 second, 1/64 second, 1/16 second, 1/4 second, 1/2 second, 1 second, or 2 seconds ? carry interrupt: a carry interrupt indicates when a carry occurs during a counter read ? automatic leap year correction 12.1.2 block diagram the following abbreviations are used in the block diagram of the rtc (figure 12.1): r64cnt: 64-hz counter rsecar: second alarm register rseccnt: second counter rminar: minute alarm register rmincnt: minute counter rhrar: hour alarm register rhrcnt: hour counter rwkar: day of the week alarm register rwkcnt: day of the week counter rdayar: date alarm register rdaycnt: date counter rmonar: month alarm register rmoncnt: month counter rcr1: rtc control register 1 ryrcnt: year counter rcr2: rtc control register 2
316 module bus rtc internal bus interrupt control circuit prescaler ( ? 2) rtcclk bus interface carry detection circuit ati pri cui r64cnt reset rseccnt rmincnt rhrcnt rwkcnt 16.384 khz rdaycnt rmoncnt ryrcnt comparator rsecar rminar rhrar rwkar rdayar rcr1 rcr2 30- second adj extal2 32.768 khz 128 hz xtal2 externally connected circuit oscillator circuit prescaler ( ? 128) rmonar figure 12.1 rtc block diagram
317 12.1.3 pin configuration table 12.1 shows the rtc pin configuration. table 12.1rtc pin configuration pin abbreviationi/o description rtc oscillator crystal pin extal2 i connects crystal to rtc oscillator rtc oscillator crystal pin xtal2 o connects crystal to rtc oscillator clock input/clock output tclk i/o external clock input pin/input capture control input pin/realtime clock (rtc) output pin (shared by tmu) dedicated power-supply pin for rtc vcc (rtc) dedicated power-supply pin for rtc* dedicated gnd pin for rtc vss (rtc) dedicated gnd pin for rtc* note: power must be supplied to the rtc power supply pins even when the rtc is not used. except in hardware standby mode, power must be supplied to all power supply pins, including these, even if only the rtc is used.
318 12.1.4 rtc register configuration table 12.2 shows the rtc register configuration. table 12.2rtc registers name abbreviationr/w initial value address access size 64-hz counter r64cnt r undefined h'fffffec0 8 second counter rseccnt r/w undefined h'fffffec2 8 minute counter rmincnt r/w undefined h'fffffec4 8 hour counter rhrcnt r/w undefined h'fffffec6 8 day of week counter rwkcnt r/w undefined h'fffffec8 8 date counter rdaycnt r/w undefined h'fffffeca 8 month counter rmoncnt r/w undefined h'fffffecc 8 year counter ryrcnt r/w undefined h'fffffece 8 second alarm register rsecar r/w undefined* h'fffffed0 8 minute alarm register rminar r/w undefined* h'fffffed2 8 hour alarm register rhrar r/w undefined* h'fffffed4 8 day of week alarm register rwkar r/w undefined* h'fffffed6 8 date alarm register rdayar r/w undefined* h'fffffed8 8 month alarm register rmonar r/w undefined* h'fffffeda 8 rtc control register 1 rcr1 r/w h'00 h'fffffedc 8 rtc control register 2 rcr2 r/w h'09 h'fffffede 8 note: only the enb bits of each register are initialized. 12.2 rtc registers 12.2.1 64-hz counter (r64cnt) the 64-hz counter (r64cnt) is an 8-bit read-only register that indicates the status of the rtc divider circuit between 64 hz and 1 hz. r64cnt is reset to h'00 by setting the reset bit in rtc control register 2 (rcr2) or the adj bit in rcr2 to 1.
319 r64cnt is not initialized by a power-on reset or manual reset, or in standby mode. bit 7 always reads 0. bit: 7 6 5 4 3 2 1 0 bit name: 1hz 2hz 4hz 8hz 16hz 32hz 64hz initial value: 0 r/w: r r r r r r r r 12.2.2 second counter (rseccnt) the second counter (rseccnt) is an 8-bit read/write register used for setting/counting in the bcd-coded second section of the rtc. the count operation is performed by a carry for each second of the 64 hz counter. the range that can be set is 00?9 (decimal). errant operation will result if any other value is set. carry out write processing after halting the count operation with the start bit in rcr2, or perform a write using the carry flag as shown in figure 12.2. rseccnt is not initialized by a power-on reset or manual reset, or in standby mode. bit: 7 6 5 4 3 2 1 0 bit name: 10 seconds 1 second initial value: 0 r/w: r r/w r/w r/w r/w r/w r/w r/w 12.2.3 minute counter (rmincnt) the minute counter (rmincnt) is an 8-bit read/write register used for setting/counting in the bcd-coded minute section of the rtc. the count operation is performed by a carry for each minute of the second counter. the range that can be set is 00?9 (decimal). errant operation will result if any other value is set. carry out write processing after halting the count operation with the start bit in rcr2, or perform a write using the carry flag as shown in figure 12.2.
320 rmincnt is not initialized by a power-on reset or manual reset, or in standby mode. bit: 7 6 5 4 3 2 1 0 bit name: 10 minutes 1 minute initial value: 0 r/w: r r/w r/w r/w r/w r/w r/w r/w 12.2.4 hour counter (rhrcnt) the hour counter (rhrcnt) is an 8-bit read/write register used for setting/counting in the bcd- coded hour section of the rtc. the count operation is performed by a carry for each 1 hour of the minute counter. the range that can be set is 00?3 (decimal). errant operation will result if any other value is set. carry out write processing after halting the count operation with the start bit in rcr2, or perform a write using the carry flag as shown in figure 12.2. rhrcnt is not initialized by a power-on reset or manual reset, or in standby mode. bit: 7 6 5 4 3 2 1 0 bit name: 10 hours 1 hour initial value: 0 0 r/w: r r r/w r/w r/w r/w r/w r/w 12.2.5 day of the week counter (rwkcnt) the day of the week counter (rwkcnt) is an 8-bit read/write register used for setting/counting in the bcd-coded day of week section of the rtc. the count operation is performed by a carry for each day of the date counter. the range that can be set is 0? (decimal). errant operation will result if any other value is set. carry out write processing after halting the count operation with the start bit in rcr2, or perform a write using the carry flag as shown in figure 12.2. rwkcnt is not initialized by a power-on reset or manual reset, or in standby mode. bit: 7 6 5 4 3 2 1 0 bit name: day of week initial value: 0 0 0 0 0 r/w: r r r r r r/w r/w r/w
321 days of the week are coded as shown in table 12.3. table 12.3day-of-week codes (rwkcnt) day of week code sunday 0 monday 1 tuesday 2 wednesday 3 thursday 4 friday 5 saturday 6 12.2.6 date counter (rdaycnt) the date counter (rdaycnt) is an 8-bit read/write register used for setting/counting in the bcd- coded date section of the rtc. the count operation is performed by a carry for each day of the hour counter. the range that can be set is 01?1 (decimal). errant operation will result if any other value is set. carry out write processing after halting the count operation with the start bit in rcr2, or perform a write using the carry flag as shown in figure 12.2. rdaycnt is not initialized by a power-on reset or manual reset, or in standby mode. the rdaycnt range that can be set changes with each month and in leap years. please confirm the correct setting. bit: 7 6 5 4 3 2 1 0 bit name: 10 days 1 day initial value: 0 0 r/w: r r r/w r/w r/w r/w r/w r/w
322 12.2.7 month counter (rmoncnt) the month counter (rmoncnt) is an 8-bit read/write register used for setting/counting in the bcd-coded month section of the rtc. the count operation is performed by a carry for each month of the date counter. the range that can be set is 00?2 (decimal). errant operation will result if any other value is set. carry out write processing after halting the count operation with the start bit in rcr2, or perform a write using the carry flag as shown in figure 12.2. rmoncnt is not initialized by a power-on reset or manual reset, or in standby mode. bit: 7 6 5 4 3 2 1 0 bit name: 10 months 1 month initial value: 0 0 0 r/w: r r r r/w r/w r/w r/w r/w 12.2.8 year counter (ryrcnt) the year counter (ryrcnt) is an 8-bit read/write register used for setting/counting in the bcd- coded year section of the rtc. the least significant 2 digits of the western calendar year are displayed. the count operation is performed by a carry for each year of the month counter. the range that can be set is 00?9 (decimal). errant operation will result if any other value is set. carry out write processing after halting the count operation with the start bit in rcr2, or perform a write using the carry flag as shown in figure 12.2. ryrcnt is not initialized by a power-on reset or manual reset, or in standby mode. leap years are recognized by dividing the year counter value by 4 and obtaining a fractional result of 0. bit: 7 6 5 4 3 2 1 0 bit name: 10 years 1 year initial value: r/w: r/w r/w r/w r/w r/w r/w r/w r/w
323 12.2.9 second alarm register (rsecar) the second alarm register (rsecar) is an 8-bit read/write register, and an alarm register corresponding to the bcd-coded second section counter rseccnt of the rtc. when the enbbit is set to 1, a comparison with the rseccnt value is performed. from among the rsecar, rminar, rhrar, rwkar, rdayar, rmonar registers, the counter and alarm register comparison is performed only on those with enb bits set to 1, and if each of those coincide, an rtc alarm interrupt is generated. the range that can be set is 00?9 (decimal) + enb bit. errant operation will result if any other value is set. the enb bit in rsecar is initialized to 0 by a power-on reset. the remaining rsecar fields are not initialized by a power-on reset or manual reset, or in standby mode. bit: 7 6 5 4 3 2 1 0 bit name: enb 10 seconds 1 second initial value: 0 r/w: r/w r/w r/w r/w r/w r/w r/w r/w 12.2.10 minute alarm register (rminar) the minute alarm register (rminar) is an 8-bit read/write register, and an alarm register corresponding to the bcd-coded minute section counter rmincnt of the rtc. when the enb bit is set to 1, a comparison with the rmincnt value is performed. from among the rsecar, rminar, rhrar, rwkar, rdayar, rmonar registers, the counter and alarm register comparison is performed only on those with enb bits set to 1, and if each of those coincide, an rtc alarm interrupt is generated. the range that can be set is 00?9 (decimal) + enb bit. errant operation will result if any other value is set. the enb bit in rminar is initialized by a power-on reset. the remaining rminar fields are not initialized by a power-on reset or manual reset, or in standby mode. contents are retained in a manual reset and in standby mode. bit: 7 6 5 4 3 2 1 0 bit name: enb 10 minutes 1 minute initial value: 0 r/w: r/w r/w r/w r/w r/w r/w r/w r/w
324 12.2.11 hour alarm register (rhrar) the hour alarm register (rhrar) is an 8-bit read/write register, and an alarm register corresponding to the bcd-coded hour section counter rhrcnt of the rtc. when the enb bitisset to 1, a comparison with the rhrcnt value is performed. from among the rsecar, rminar, rhrar, rwkar, rdayar, rmonar registers, the counter and alarm register comparison is performed only on those with enb bits set to 1, and if each of those coincide, an rtc alarm interrupt is generated. the range that can be set is 00?3 (decimal) + enb bit. errant operation will result if any other value is set. the enb bit in rhrar is initialized by a power-on reset. the remaining rhrar fields are not initialized by a power-on reset or manual reset, or in standby mode. contents are retained in a manual reset and in standby mode. bit: 7 6 5 4 3 2 1 0 bit name: enb 10 hours 1 hour initial value: 0 0 r/w: r/w r r/w r/w r/w r/w r/w r/w 12.2.12 day of the week alarm register (rwkar) the day of the week alarm register (rwkar) is an 8-bit read/write register, and an alarm register corresponding to the bcd-coded day of week section counter rwkcnt of the rtc. when the enb bit is set to 1, a comparison with the rwkcnt value is performed. from among the rsecar, rminar, rhrar, rwkar, rdayar, rmonar registers, the counter and alarm register comparison is performed only on those with enb bits set to 1, and if each of those coincide, an rtc alarm interrupt is generated. the range that can be set is 0? (decimal) + enb bit. errant operation will result if any other value is set. the enb bit in rwkar is initialized by a power-on reset. the remaining rwkar fields are not initialized by a power-on reset or manual reset, or in standby mode. contents are retained in a manual reset and in standby mode. bit: 7 6 5 4 3 2 1 0 bit name: enb day of week initial value: 0 0 0 0 0 r/w: r/w r r r r r/w r/w r/w
325 days of the week are coded as shown in table 12.4. table 12.4day-of-week codes (rwkar) day of week code sunday 0 monday 1 tuesday 2 wednesday 3 thursday 4 friday 5 saturday 6 12.2.13 date alarm register (rdayar) the date alarm register (rdayar) is an 8-bit read/write register, and an alarm register corresponding to the bcd-coded date section counter rdaycnt of the rtc. when the enb bit is set to 1, a comparison with the rdaycnt value is performed. from among the registers rsecar, rminar, rhrar, rwkar, rdayar, rmonar, the counter and alarm register comparison is performed only on those with enb bits set to 1, and if each of those coincide, an rtc alarm interrupt is generated. the range that can be set is 01?1 (decimal) + enb bit. errant operation will result if any other value is set. the rdaycnt range that can be set changes with some months and in leap years. please confirm the correct setting. the enb bit in rdayar is initialized by a power-on reset. the remaining rdayar fields are not initialized by a power-on reset or manual reset, or in standby mode. contents are retained in a manual reset and in standby mode. bit: 7 6 5 4 3 2 1 0 bit name: enb 10 days 1 day initial value: 0 0 r/w: r/w r r/w r/w r/w r/w r/w r/w
326 12.2.14 month alarm register (rmonar) the month alarm register (rmonar) is an 8-bit read/write register, and an alarm register corresponding to the bcd-coded month section counter rmoncnt of the rtc. when the enb bit is set to 1, a comparison with the rmoncnt value is performed. from among the registers rsecar, rminar, rhrar, rwkar, rdayar, rmonar, the counter and alarm register comparison is performed only on those with enb bits set to 1, and if each of those coincide, an rtc alarm interrupt is generated. the range that can be set is 01?2 (decimal) + enb bit. errant operation will result if any other value is set. the enb bit in rmonar is initialized by a power-on reset. the remaining rmonar fields are not initialized by a power-on reset or manual reset, or in standby mode. contents are retained in a manual reset and in standby mode. bit: 7 6 5 4 3 2 1 0 bit name: enb 10 months 1 month initial value: 0 0 0 r/w: r/w r r r/w r/w r/w r/w r/w 12.2.15 rtc control register 1 (rcr1) the rtc control register 1 (rcr1) is an 8-bit read/write register that affects carry flags and alarm flags. it also selects whether to generate interrupts for each flag. because flags are sometimes set after an operand read, do not use this register in read-modify-write processing. rcr1 is initialized to h'00 by a power-on reset. in a manual reset, all bits are initialized to 0 except for the cf flag, which is undefined. when using the cf flag, it must be initialized beforehand. this register is not initialized in standby mode. bit: 7 6 5 4 3 2 1 0 bit name: cf cie aie af initial value: 0 0 0 0 0 0 0 0 r/w: r/w r r r/w r/w r r r/w
327 bit 7?arry flag (cf): status flag that indicates that a carry has occurred. cf is set to 1 when a count-up to r64cnt or rseccnt occurs. a count register value read at this time cannot be guaranteed; another read is required. bit 7: cf description 0 no count up of r64cnt or rseccnt. clearing condition: when 0 is written to cf (initial value) 1 count up of r64cnt or rseccnt. setting condition: when 1 is written to cf bits 6, 5, 2, and 1?eserved: these bits always read 0. the write value should always be 0. bit 4?arry interrupt enable flag (cie): when the carry flag (cf) is set to 1, the cie bit enables interrupts. bit 4: cie description 0 a carry interrupt is not generated when the cf flag is set to 1 (initial value) 1 a carry interrupt is generated when the cf flag is set to 1 bit 3?larm interrupt enable flag (aie): when the alarm flag (af) is set to 1, the aie bit allows interrupts. bit 3: aie description 0 an alarm interrupt is not generated when the af flag is set to 1 (initial value) 1 an alarm interrupt is generated when the af flag is set to 1 bit 0?larm flag (af): the af flag is set to 1 when the alarm time set in an alarm register (only registers with enb bit set to 1) matches the clock and calendar time. this flag is cleared to 0 by writing 0, but retains its previous value if 1 is written. bit 0: af description 0 clock/counter and alarm register have not matched since last reset to 0. clearing condition: when 0 is written to af (initial value) 1 setting condition: clock/counter and alarm register have matched (only registers with enb set)* note: contents do not change when 1 is written to af.
328 12.2.16 rtc control register 2 (rcr2) the rtc control register 2 (rcr2) is an 8-bit read/write register for periodic interrupt control, 30- second adjustment adj, divider circuit reset, and rtc count start/stop control. it is initialized to h'09 by a power-on reset. it is not initialized by a manual reset or in standby mode, and retains its contents. bit: 7 6 5 4 3 2 1 0 bit name: pef pes2 pes1 pes0 rtcen adj reset start initial value: 0 0 0 0 1 0 0 1 r/w: r/w r/w r/w r/w r/w r/w r/w r/w bit 7?eriodic interrupt flag (pef): indicates interrupt generation with the period designated by the pes bits. when set to 1, pef generates periodic interrupts. bit 7: pef description 0 interrupts not generated with the period designated by the pes bits. clearing condition: when 0 is written to pef (initial value) 1 interrupts generated with the period designated by the pes bits. setting condition: when 1 is written to pef bits 6??eriodic interrupt flags (pes2?es0): these bits specify the periodic interrupt. bit 6: pes2 bit 5: pes1 bit 4: pes0 description 0 0 0 no periodic interrupts generated (initial value) 1 periodic interrupt generated every 1/256 second 1 0 periodic interrupt generated every 1/64 second 1 periodic interrupt generated every 1/16 second 1 0 0 periodic interrupt generated every 1/4 second 1 periodic interrupt generated every 1/2 second 1 0 periodic interrupt generated every 1 second 1 periodic interrupt generated every 2 seconds bit 3?tcen: controls the operation of the crystal oscillator for the rtc.
329 bit 3: rtcen description 0 halts the crystal oscillator for the rtc. 1 runs the crystal oscillator for the rtc. (initial value) bit 2?0-second adjustment (adj): when 1 is written to the adj bit, times of 29 seconds or less will be rounded to 00 seconds and 30 seconds or more to 1 minute. the divider circuit will be simultaneously reset. this bit always reads 0. bit 2: adj description 0 runs normally. (initial value) 1 (write) 30-second adjustment. bit 1?eset (reset): when 1 is written, initializes the divider circuit. this bit always reads 0. bit 1: reset description 0 runs normally. (initial value) 1 divider circuit is reset. bit 0?tart bit (start): halts and restarts the counter (clock). bit 0: start description 0 second, minute, hour, day, week, month, year counter halts. 1 second, minute, hour, day, week, month, year counter runs normally. (initial value) note: the 64-hz counter always runs unless stopped with the rtcen bit. 12.3 rtc operation 12.3.1 initial settings of registers after power-on all the registers should be set after the power is turned on. 12.3.2 setting the time
330 part (a) in figure 12.2 shows how to set the time when the clock is stopped. this works when the entire calendar or clock is to be set. part (b) in figure 12.2 describes how to set the clock when the clock is running. this works when only part of the calendar or clock needs to be reset (e.g., changing only the seconds or only the hour). the write status is checked using the carry flags. when there is a carry during the writing of new data, the new data is automatically updated. since this causes errors in the data, the data must be rewritten if the carry flag is set to 1. the interrupt function can be used to determine the status of the carry flag. write 1 to reset and 0 to start in the rcr2 register order is irrelevant write 1 to start in the rcr2 register set seconds, minutes, hour, day, day of the week, month and year read rcr1 and check cf carry flag = 1? no yes stop clock, reset divider circuit a. to reset the divider circuit and set the counter b. to set the seconds-year counter start clock clear the carry flag write the counter register write 0 to cf in rcr1 note: set af to 1 so that alarm flag is not cleared figure 12.2 setting the time
331 12.3.3 reading the time figure 12.3 shows how to read the time. if a carry occurs while reading the time, the correct time will not be obtained, so it must be read again. part (a) in figure 12.3 shows the method of reading the time without using interrupts; part (b) in figure 12.3 shows the method using carry interrupts. to keep programming simple, method (a) should normally be used. write 0 to cf in rcr1 note: set af to 1 so that alarm flag is not cleared. write 0 to cie in rcr1 read rcr1 and check cf write 0 to cie in rcr1 carry flag = 1? no yes clear the carry flag disable the carry interrupt read counter register write 1 to cie in rcr1, and write 0 to cf in rcr1 note: set af in rcr1 to 1 so that alarm flag is not cleared. interrupt generated? no yes enable the carry interrupt clear the carry flag disable the carry interrupt read counter register to read the time without using interrupts b. to use interrupts a. figure 12.3 reading the time
332 12.3.4 alarm function figure 12.4 shows how to use the alarm function. alarms can be generated using seconds, minutes, hours, day of the week, date, month, or any combination of these. set the enb bit (bit 7) in the register on which the alarm is placed to 1, and then set the alarm time in the lower bits. clear the enb bit in the register on which the alarm is placed to 0. when the clock and alarm times match, a 1 is set in the af bit (bit 0) in rcr1. alarm detection can be checked by reading this bit, but normally it is done by interrupt. if 1 is placed in the aie bit (bit 3) in rcr1, an interrupt is generated when an alarm occurs. temporarily disable interrupts (clear aie bit in rcr1 register to 0) to prevent erroneous interruption clock running set alarm time clear alarm interrupt when interrupts are used, enable interrupts (set aie bit in rcr1 register to 1) flag must be reset (by clearing af bit in rcr1 register to 0) since it was set during alarm time setting set alarm interrupt clear alarm flag monitor alarm time (wait for interrupt or check alarm flag) figure 12.4 using the alarm function
333 12.3.5 crystal oscillator circuit crystal oscillator circuit constants (recommended values) are shown in table 12.5, and the rtc crystal oscillator circuit in figure 12.5. table 12.5recommended oscillator circuit constants (recommended values) f osc c in c out 32.768 khz 10 to 22 pf 10 to 22 pf sh7708 series extal2 xtal2 xtal c in c out r f r d notes: 1. select either the c in or c out side for frequency adjustment variable capacitor according to requirements such as frequency range, degree of stability, etc. 2. built-in resistance value r f (typ value) = 10 m w , r d (typ value) = 400 k w 3. c in and c out values include floating capacitance due to the wiring. take care when using a ground plane. 4. the crystal oscillation settling time depends on the mounted circuit constants, floating capacitance, etc., and should be decided after consultation with the crystal resonator manufacturer. 5. place the crystal resonator and load capacitors c in and c out as close as possible to the chip. (correct oscillation may not be possible if there is externally induced noise in the extal2 and xtal2 pins.) 6. ensure that the crystal resonator connection pin (extal2, xtal2) wiring is routed as far away as possible from other power lines (except gnd) and signal lines. figure 12.5 example of crystal oscillator circuit connection
334 12.4 usage notes 12.4.1 flag clearing with the sh7708, the procedure shown in the flowchart below should be used to clear the carry flag (cf) and alarm flag (af) in realtime clock (rtc) register rcr1 (rtc control register 1) and the peripheral interrupt flag (pef) in register rcr2 (rtc control register 2). wait for 63 s or more entire lot 1. transition to standby mode 2. change stc0, stc1 in feqcr (frequency control register) 3. change mstp1 in stbcr (standby control register) clear af flag figure 12.6 af flag clearing if an interval of at least 63 m s is not allowed, the af flag may not be set even if the setting conditions are satisfied. use the same procedure for clearing the cf and pef flags.
335 section 13 serial communication interface (sci) 13.1 overview the sh7708 series has an on-chip serial communication interface (sci) that supports both asynchronous and synchronous serial communication. it also has a multiprocessor communication function for serial communication among two or more processors. the sci supports a smart card interface, which is a serial communications feature for ic card interfaces that conforms to the iso/iec standard 7816-3 for identification cards. see section 14, smart card interface, for more information. 13.1.1 features sci features are listed below. ? asynchronous or synchronous can be selected as the serial communication mode. ? asynchronous mode: ? serial data communication is synchronized in start-stop mode in character units. the sci can communicate with a universal asynchronous receiver/transmitter (uart), an asynchronous communication interface adapter (acia), or any other communications chip that employs a standard asynchronous serial system. it can also communicate with two or more other processors using the multiprocessor communication function. the maximum bit rate is 937.5 kbps. there are twelve selectable serial data communication formats. ? data length: seven or eight bits ? stop bit length: one or two bits ? parity: even, odd, or none ? multiprocessor bit: 1 or 0 ? receive error detection: parity, overrun, and framing errors ? break detection: by reading the rxd level directly from the serial port register (scsptr) when a framing error occurs ? synchronous mode: ? serial data communication is synchronized with a clock signal. the sci can communicate with other chips having a synchronous communication function. the maximum bit rate is 5 mbps. there is one serial data communication format. ? data length: eight bits ? receive error detection: overrun errors ? full duplex communication: the transmitting and receiving sections are independent, so the sci can transmit and receive simultaneously. both sections use double buffering, so continuous data transfer is possible in both the transmit and receive directions. ? on-chip baud rate generator with selectable bit rates
336 ? internal or external transmit/receive clock source: from either baud rate generator (internal) or sck pin (external) ? four types of interrupts: transmit-data-empty, transmit-end, receive-data-full, and receive-error interrupts are requested independently. ? when the sci is not in use, it can be stopped by halting the clock supplied to it, saving power. 13.1.2 block diagram figure 13.1 shows a block diagram of the sci. rxd txd sck sci scbrr scscr scssr scsmr sctdr sctsr scrdr scrsr scsptr parity generation parity check clock external clock module data bus internal data bus p f p f /4 p f /16 p f /64 tei txi rxi eri bus interface baud rate generator transmit/ receive control scrsr: scrdr: sctsr: sctdr: receive shift register receive data register transmit shift register transmit data register scsmr: scscr: scssr: scbrr: scsptr: serial mode register serial control register serial status register bit rate register serial port register figure 13.1 sci block diagram
337 13.1.3 pin configuration the sci has the serial pins summarized in table 13.1. table 13.1sci pins pin name abbreviationinput/output function serial clock pin sck input/output clock input/output receive data pin rxd input receive data input transmit data pin txd output transmit data output note: these pins function as mode input pins md0?d02 after a power-on reset. they are made to function as serial pins by performing sci operation settings with the te, re, ckei, and cke0 bits in scscr and the c/ a bit in scsmr. break status transmission and detection can be performed by means of the sci? scsptr register. 13.1.4 register configuration table 13.2 summarizes the sci internal registers. these registers select the communication mode (asynchronous or synchronous), specify the data format and bit rate, and control the transmitter and receiver sections. table 13.2 registers name abbreviation r/w initial value* 2 address access size serial mode register scsmr r/w h'00 h'fffffe80 8 bit rate register scbrr r/w h'ff h'fffffe82 8 serial control register scscr r/w h'00 h'fffffe84 8 transmit data register sctdr r/w h'ff h'fffffe86 8 serial status register scssr r/(w)* 1 h'84 h'fffffe88 8 receive data register scrdr r h'00 h'fffffe8a 8 serial port register scsptr r/w undefined (initialized)* 3 h'ffffff7c 8 notes: 1 only 0 can be written, to clear the flags. 2 initialized by power-on reset or manual reset. 3. all bits except 2 and 0 are initialized to 0. the value of bits 2 and 0 is undefined.
338 13.2 register descriptions 13.2.1 receive shift register (scrsr) the receive shift register (scrsr) receives serial data. data input at the rxd pin is loaded into scrsr in the order received, lsb (bit 0) first, converting the data to parallel form. when one byte has been received, it is automatically transferred to scrdr. the cpu cannot read or write scrsr directly. bit: 7 6 5 4 3 2 1 0 bit name: r/w: 13.2.2 receive data register (scrdr) the receive data register (scrdr) stores serial receive data. the sci completes the reception of one byte of serial data by moving the received data from the receive shift register (scrsr) into scrdr for storage. scrsr is then ready to receive the next data. this double buffering allows the sci to receive data continuously. the cpu can read but not write to scrdr. scrdr is initialized to h'00 by a reset and in standby or module standby mode. bit: 7 6 5 4 3 2 1 0 bit name: initial value: 0 0 0 0 0 0 0 0 r/w: r r r r r r r r 13.2.3 transmit shift register (sctsr) the transmit shift register (sctsr) transmits serial data. the sci loads transmit data from the transmit data register (sctdr) into sctsr, then transmits the data serially from the txd pin, lsb (bit 0) first. after transmitting one data byte, the sci automatically loads the next transmit data from sctdr into sctsr and starts transmitting again. if the tdre bit in scssr is 1, however, the sci does not load the sctdr contents into sctsr. the cpu cannot read or write to sctsr directly. bit: 7 6 5 4 3 2 1 0 bit name: r/w:
339 13.2.4 transmit data register (sctdr) the transmit data register (sctdr) is an 8-bit register that stores data for serial transmission. when the sci detects that the transmit shift register (sctsr) is empty, it moves transmit data written in sctdr into sctsr and starts serial transmission. continuous serial transmission is possible by writing the next transmit data in sctdr during serial transmission from sctsr. the cpu can always read and write to sctdr. sctdr is initialized to h'ff by a reset and in standby or module standby mode. bit: 7 6 5 4 3 2 1 0 bit name: initial value: 1 1 1 1 1 1 1 1 r/w: r/w r/w r/w r/w r/w r/w r/w r/w 13.2.5 serial mode register (scsmr) the serial mode register (scsmr) is an 8-bit register that specifies the sci serial communication format and selects the clock source for the baud rate generator. the cpu can always read and write to scsmr. scsmr is initialized to h'00 by a reset and in standby or module standby mode. bit: 7 6 5 4 3 2 1 0 bit name: c/ a chr pe o/ e stop mp cks1 cks0 initial value: 0 0 0 0 0 0 0 0 r/w: r/w r/w r/w r/w r/w r/w r/w r/w bit 7?ommunication mode (c/ a ): selects whether the sci operates in asynchronous or synchronous mode. bit 7: c/ a description 0 asynchronous mode (initial value) 1 synchronous mode
340 bit 6?haracter length (chr): selects 7-bit or 8-bit data in asynchronous mode. in synchronous mode, the data length is always 8 bits, regardless of the chr setting. bit 6: chr description 0 8-bit data (initial value) 1 7-bit data. (when 7-bit data is selected, the msb (bit 7) of the transmit data register is not transmitted.) bit 5?arity enable (pe): selects whether to add a parity bit to transmit data and to check the parity of receive data, in asynchronous mode. in synchronous mode, a parity bit is neither added nor checked, regardless of the pe setting. bit 5: pe description 0 parity bit not added or checked (initial value) 1 parity bit added and checked. when pe is set to 1, an even or odd parity bit is added to transmit data, depending on the parity mode (o/ e ) setting. receive data parity is checked according to the even/odd (o/ e ) mode setting. bit 4?arity mode (o/ e ): selects even or odd parity when parity bits are added and checked. the o/ e setting is used only in asynchronous mode and only when the parity enable bit (pe) is set to 1 to enable parity addition and checking. the o/ e setting is ignored in synchronous mode, and in asynchronous mode when parity addition and checking is disabled. bit 4: o/ e description 0 even parity (initial value) if even parity is selected, the parity bit is added to transmit data to make an even number of 1s in the transmitted character and parity bit combined. receive data is checked to see if it has an even number of 1s in the received character and parity bit combined. 1 odd parity if odd parity is selected, the parity bit is added to transmit data to make an odd number of 1s in the transmitted character and parity bit combined. receive data is checked to see if it has an odd number of 1s in the received character and parity bit combined.
341 bit 3?top bit length (stop): selects one or two bits as the stop bit length in asynchronous mode. this setting is used only in asynchronous mode. it is ignored in synchronous mode because no stop bits are added. in receiving, only the first stop bit is checked, regardless of the stop bit setting. if the second stop bit is 1, it is treated as a stop bit, but if the second stop bit is 0, it is treated as the start bit of the next incoming character. bit 3: stop description 0 one stop bit (initial value) in transmitting, a single 1-bit is added at the end of each transmitted character. 1 two stop bits in transmitting, two 1-bits are added at the end of each transmitted character. bit 2?ultiprocessor mode (mp): selects multiprocessor format. when multiprocessor format is selected, settings of the parity enable (pe) and parity mode (o/ e ) bits are ignored. the mp bit setting is used only in asynchronous mode; it is ignored in synchronous mode. for the multiprocessor communication function, see section 13.3.3, multiprocessor communication. bit 2: mp description 0 multiprocessor function disabled (initial value) 1 multiprocessor format selected bits 1 and 0?lock select 1 and 0 (cks1 and cks0): these bits select the internal clock source of the on-chip baud rate generator. four clock sources are available: p f , p f /4, p f /16 and p f /64. for further information on the clock source, bit rate register settings, and baud rate, see section 13.2.9, bit rate register. bit 1: cks1 bit 0: cks0 description 00p f (initial value) 1p f /4 10p f /16 1p f /64 note: p f : peripheral clock
342 13.2.6 serial control register (scscr) the serial control register (scscr) operates the sci transmitter/receiver, selects the serial clock output in asynchronous mode, enables/disables interrupt requests, and selects the transmit/receive clock source. the cpu can always read and write to scscr. scscr is initialized to h'00 by a reset and in standby or module standby mode. bit: 7 6 5 4 3 2 1 0 bit name: tie rie te re mpie teie cke1 cke0 initial value: 0 0 0 0 0 0 0 0 r/w: r/w r/w r/w r/w r/w r/w r/w r/w bit 7?ransmit interrupt enable (tie): enables or disables the transmit-data-empty interrupt (txi) requested when the transmit data register empty bit (tdre) in the serial status register (scssr) is set to 1 due to transfer of serial transmit data from sctdr to sctsr. bit 7: tie description 0 transmit-data-empty interrupt request (txi) is disabled. (initial value) the txi interrupt request can be cleared by reading tdre after it has been set to 1, then clearing tdre to 0, or by clearing tie to 0. 1 transmit-data-empty interrupt request (txi) is enabled. bit 6?eceive interrupt enable (rie): enables or disables the receive-data-full interrupt (rxi) requested when the receive data register full bit (rdrf) in the serial status register (scssr) is set to 1 due to transfer of serial receive data from scrsr to scrdr. it also enables or disables receive-error interrupt (eri) requests. bit 6: rie description 0 receive-data-full interrupt (rxi) and receive-error interrupt (eri) requests are disabled. (initial value) rxi and eri interrupt requests can be cleared by reading the rdrf flag or error flag (fer, per, or orer) after it has been set to 1, then clearing the flag to 0, or by clearing rie to 0. 1 receive-data-full interrupt (rxi) and receive-error interrupt (eri) requests are enabled. bit 5?ransmit enable (te): enables or disables the sci serial transmitter.
343 bit 5: te description 0 transmitter disabled (initial value) the transmit data register empty bit (tdre) in the serial status register (scssr) is locked at 1. 1 transmitter enabled serial transmission starts when the transmit data register empty (tdre) bit in the serial status register (scssr) is cleared to 0 after writing of transmit data into sctdr. select the transmit format in scsmr before setting te to 1. bit 4?eceive enable (re): enables or disables the sci serial receiver. bit 4: re description 0 receiver disabled (initial value) clearing re to 0 does not affect the receive flags (rdrf, fer, per, orer). these flags retain their previous values. 1 receiver enabled serial reception starts when a start bit is detected in asynchronous mode, or synchronous clock input is detected in synchronous mode. select the receive format in scsmr before setting re to 1. bit 3?ultiprocessor interrupt enable (mpie): enables or disables multiprocessor interrupts. the mpie setting is used only in asynchronous mode, and only if the multiprocessor mode bit (mp) in the serial mode register (scsmr) is set to 1 during reception. the mpie setting is ignored in synchronous mode or when the mp bit is cleared to0.
344 bit 3: mpie description 0 multiprocessor interrupts are disabled (normal receive operation). (initial value) mpie is cleared to 0 by writing 0 to it, or when the multiprocessor bit (mpb) is set to 1 in receive data. 1 multiprocessor interrupts are enabled. receive-data-full interrupt requests (rxi), receive-error interrupt requests (eri), and setting of the rdrf, fer, and orer status flags in the serial status register (scssr) are disabled until data with a multiprocessor bit of 1 is received. the sci does not transfer receive data from scrsr to scrdr, does not detect receive errors, and does not set the rdrf, fer, and orer flags in the serial status register (scssr). when it receives data that includes mpb = 1, the scssr? mpb flag is set to 1, and the sci automatically clears mpie to 0, generates rxi and eri interrupts (if the tie and rie bits in scscr are set to 1), and allows the fer and orer bits to be set. bit 2?ransmit-end interrupt enable (teie): enables or disables the transmit-end interrupt (tei) requested if sctdr does not contain new transmit data when the msb is transmitted. bit 2: teie description 0 transmit-end interrupt (tei) requests are disabled.* (initial value) 1 transmit-end interrupt (tei) requests are enabled.* note: the tei request can be cleared by reading the tdre bit in the serial status register (scssr) after it has been set to 1, then clearing tdre to 0 and clearing the transmit end (tend) bit to 0, or by clearing the teie bit to 0. bits 1 and 0?lock enable 1 and 0 (cke1 and cke0): these bits select the sci clock source and enable or disable clock output from the sck pin. depending on the combination of cke1 and cke0, the sck pin can be used for serial clock output or serial clock input. the cke0 setting is valid only in asynchronous mode, and only when the sci is internally clocked (cke1 = 0). the cke0 setting is ignored in synchronous mode, or when an external clock source is selected (cke1 = 1). before selecting the sci operating mode in the serial mode register (scsmr), set cke1 and cke0. for further details on selection of the sci clock source, see table 13.9 in section 13.3, operation.
345 bit 1: cke1 bit 0: cke0 description 0 0 asynchronous mode internal clock, sck pin used for input pin (input signal is ignored) (initial value) synchronous mode internal clock, sck pin used for serial clock output (initial value) 1 asynchronous mode internal clock, sck pin used for clock output* 1 synchronous mode internal clock, sck pin used for serial clock output 1 0 asynchronous mode external clock, sck pin used for clock input* 2 synchronous mode external clock, sck pin used for serial clock input 1 asynchronous mode external clock, sck pin used for clock input* 2 synchronous mode external clock, sck pin used for serial clock input notes: 1. the output clock frequency is the same as the bit rate. 2 the input clock frequency is 16 times the bit rate. 13.2.7 serial status register (scssr) the serial status register (scssr) is an 8-bit register containing multiprocessor bit values, and status flags that indicate the sci operating status. the cpu can always read and write to scssr, but cannot write 1 in the status flags (tdre, rdrf, orer, per, and fer). these flags can be cleared to 0 only if they have first been read (after being set to 1). bits 2 (tend) and 1 (mpb) are read-only bits that cannot be written. scssr is initialized to h'84 by a reset and in standby or module standby mode. bit: 7 6 5 4 3 2 1 0 bit name: tdre rdrf orer fer per tend mpb mpbt initial value: 1 0 0 0 0 1 0 0 r/w: r/(w)* r/(w)* r/(w)* r/(w)* r/(w)* r r r/w note: only 0 can be written, to clear the flag. bit 7?ransmit data register empty (tdre): indicates that the sci has loaded transmit data from sctdr into sctsr and new serial transmit data can be written in sctdr.
346 bit 7: tdre description 0 sctdr contains valid transmit data. tdre is cleared to 0 when software reads tdre after it has been set to 1, then writes 0 in tdre, or data is written in sctdr. 1 sctdr does not contain valid transmit data. (initial value) tdre is set to 1 when the chip is reset or enters standby mode, the te bit in the serial control register (scscr) is cleared to 0, or sctdr contents are loaded into sctsr, so new data can be written in sctdr. bit 6?eceive data register full (rdrf): indicates that scrdr contains received data. bit 6: rdrf description 0 scrdr does not contain valid received data. (initial value) rdrf is cleared to 0 when the chip is reset or enters standby mode, software reads rdrf after it has been set to 1, then writes 0 in rdrf, or data is read from scrdr. 1 scrdr contains valid received data. rdrf is set to 1 when serial data is received normally and transferred from scrsr to scrdr. note: scrdr and rdrf are not affected by detection of receive errors or by clearing of the re bit to 0 in the serial control register. they retain their previous contents. if rdrf is still set to 1 when reception of the next data ends, an overrun error (orer) occurs and the receive data is lost. bit 5?verrun error (orer): indicates that data reception aborted due to an overrun error. bit 5: orer description 0 receiving is in progress or has ended normally. (initial value) clearing the re bit to 0 in the serial control register does not affect the orer bit, which retains its previous value. orer is cleared to 0 when the chip is reset or enters standby mode or software reads orer after it has been set to 1, then writes 0 in orer. 1 a receive overrun error occurred. scrdr continues to hold the data received before the overrun error, so subsequent receive data is lost. serial receiving cannot continue while orer is set to 1. in synchronous mode, serial transmitting is also disabled. orer is set to 1 if reception of the next serial data ends when rdrf is set to 1.
347 bit 4?raming error (fer): indicates that data reception aborted due to a framing error in asynchronous mode. bit 4: fer description 0 receiving is in progress or has ended normally. (initial value) clearing the re bit to 0 in the serial control register does not affect the fer bit, which retains its previous value. fer is cleared to 0 when the chip is reset or enters standby mode or software reads fer after it has been set to 1, then writes 0 in fer. 1 a receive framing error occurred. when the stop bit length is two bits, only the first bit is checked. the second stop bit is not checked. when a framing error occurs, the sci transfers the receive data into scrdr but does not set rdrf. serial receiving cannot continue while fer is set to 1. in synchronous mode, serial transmitting is also disabled. fer is set to 1 if the stop bit at the end of receive data is checked and found to be 0. bit 3?arity error (per): indicates that data reception (with parity) aborted due to a parity error in asynchronous mode. bit 3: per description 0 receiving is in progress or has ended normally. (initial value) clearing the re bit to 0 in the serial control register does not affect the per bit, which retains its previous value. per is cleared to 0 when the chip is reset or enters standby mode or software reads per after it has been set to 1, then writes 0 in per. 1 a receive parity error occurred. when a parity error occurs, the sci transfers the receive data into scrdr but does not set rdrf. serial receiving cannot continue while per is set to 1. in synchronous mode, serial transmitting is also disabled. per is set to 1 if the number of 1s in receive data, including the parity bit, does not match the even or odd parity setting of the parity mode bit (o/e) in the serial mode register (scsmr).
348 bit 2?ransmit end (tend): indicates that when the last bit of a serial character was transmitted, sctdr did not contain valid data, so transmission has ended. tend is a read-only bit and cannot be written. bit 2: tend description 0 transmission is in progress. tend is cleared to 0 when software reads tdre after it has been set to 1, then writes 0 in tdre, or data is written in sctdr. 1 end of transmission. (initial value) tend is set to 1 when the chip is reset or enters standby mode, te is cleared to 0 in the serial control register (scscr), or tdre is 1 when the last bit of a one-byte serial character is transmitted. bit 1?ultiprocessor bit (mpb): stores the value of the multiprocessor bit in receive data when a multiprocessor format is selected for receiving in asynchronous mode. mpb is a read-only bit and cannot be written. bit 1: mpb description 0 multiprocessor bit value in receive data is 0. (initial value) if re is cleared to 0 when a multiprocessor format is selected, the mpb retains its previousvalue. 1 multiprocessor bit value in receive data is 1. bit 0?ultiprocessor bit transfer (mpbt): stores the value of the multiprocessor bit added to transmit data when a multiprocessor format is selected for transmitting in asynchronous mode. the mpbt setting is ignored in synchronous mode, when a multiprocessor format is not selected, or when the sci is not transmitting. bit 0: mpbt description 0 multiprocessor bit value in transmit data is 0. (initial value) 1 multiprocessor bit value in transmit data is 1.
349 13.2.8 serial port register (scsptr) the serial port register (scsptr) is an 8-bit register that the cpu can always read and write. it controls i/o and data of the port multiplexed with the serial communications interface (sci) pins. input data can be read from the rxd pin and output data can be transmitted to the txd pin; this controls breaks for serial transmission and reception. scsptr is initialized to h'00 by a power-on reset. it is not initialized by a manual reset or in standby mode. bit: 7 6 5 4 3 2 1 0 bit name: spb1io spb1dt spb0io spb0dt initial value: 0 0 0 0 0 0 r/w: r r r r r/w r/w r/w r/w bits 7 to 4?eserved: these bits always read 0. the write value should always be 0. bit 3?erial port clock port i/o (spb1io): specifies serial port sck pin input/output. when the sck pin is actually set as a port output pin and outputs the value set by the spb1dt bit, the c/ a bit in scsmr and the cke1 and cke0 bits in scscr should be cleared to 0. bit 3: spb1io description 0 the spb1dt value is not output to the sck pin. (initial value) 1 the spb1dt bit value is output to the sck pin. bit 2?erial port clock port data (spb1dt): specifies the serial port sck pin input/output data. input or output is specified by the spb1io bit (see the description of spb1io for details). when output is specified, the value of the spb1dt bit is output to the sck pin. the sck pin value is read from the spb1dt bit regardless of the value of the spb1io bit. the initial value of this bit after a power-on reset is undefined. bit 2: spb1dt description 0 i/o data level is low. (initial value) 1 i/o data level is high. bit 1?erial port break i/o (spb0io): specifies the serial port txd pin output condition. when the txd pin is actually set as a port output pin and outputs the value set by the spb0dt bit, the te bit in scscr should be cleared to 0.
350 bit 1: spb0io description 0 the spb0dt bit value is not output to the txd pin. (initial value) 1 the spb0dt bit value is output to the txd pin. bit 0?erial port break data (spb0dt): specifies the serial port i/o data. use the spb0io bit to specify input or output of txd pin. see the description of spb0io for details. spb0dt bit is output to the txd pin when specified as output. the rxd pin value is read from the spb0io bit regardless of the spb0io bit value. the initial value is undefined. bit 0 : spb0dt description 0 i/o data level is low. (initial value) 1 i/o data level is high. block diagrams of the sci i/o port pins are shown in figures 15.2 to 15.4 in section 15, i/o ports. 13.2.9 bit rate register (scbrr) the bit rate register (scbrr) is an 8-bit register that, together with the baud rate generator clock source selected by the cks1 and cks0 bits in the serial mode register (scsmr), determines the serial transmit/receive bit rate. the cpu can always read and write to scbrr. scbrr is initialized to h'ff by a reset and in module standby or standby mode. each channel has independent baud rate generator control, so different values can be set in the two channels. bit: 7 6 5 4 3 2 1 0 bit name: initial value: 1 1 1 1 1 1 1 1 r/w: r/w r/w r/w r/w r/w r/w r/w r/w the scbrr setting is calculated as follows: asynchronous mode: n = [p f /(64 2 2n ?1 b)] 10 6 ?1 synchronous mode: n = [p f /(8 2 2n ?1 b)] 10 6 ?1 b: bit rate (bit/s) n: scbrr setting for baud rate generator (0 n 255) p f : operating frequency for peripheral modules (mhz) n: baud rate generator clock source (n = 0, 1, 2, 3) (for the clock sources and values of n, see table 13.3.)
351 table 13.3 scsmr settings scsmr settings n clock source cks1 cks0 0p f 00 1p f /4 0 1 2p f /16 1 0 3p f /64 1 1 note: the bit rate error for asynchronous mode is given by the following formula: error (%) = {p( f 10 6 )/[(n + 1) b 64 2 2n ?1 ] ?1 } 100 table 13.4 lists examples of scbrr settings in asynchronous mode; table 13.5 lists examples of scbrr settings in synchronous mode. table 13.4 bit rates and scbrr settings in asynchronous mode p f (mhz) 2 2.097152 2.4576 bit rate (bit/s) n n error (%)n n error (%)n n error (%) 110 1 141 0.03 1 148 ?.04 1 174 ?.26 150 1 103 0.16 1 108 0.21 1 127 0.00 300 0 207 0.16 0 217 0.21 0 255 0.00 600 0 103 0.16 0 108 0.21 0 127 0.00 1200 0 51 0.16 0 54 ?.70 0 63 0.00 2400 0 25 0.16 0 26 1.14 0 31 0.00 4800 0 12 0.16 0 13 ?.48 0 15 0.00 9600 0 6 ?.99 0 6 ?.48 0 7 0.00 19200 0 2 8.51 0 2 13.78 0 3 0.00 31250 0 1 0.00 0 1 4.86 0 1 22.88 38400 0 1 18.62 0 1 14.67 0 1 0.00
352 table 13.4 bit rates and scbrr settings in asynchronous mode (cont) p f (mhz) 3 3.6864 4 bit rate (bit/s) n n error (%)n n error (%)n n error (%) 110 1 212 0.03 2 64 0.70 2 70 0.03 150 1 155 0.16 1 191 0.00 1 207 0.16 300 1 77 0.16 1 95 0.00 1 103 0.16 600 0 155 0.16 0 191 0.00 0 207 0.16 1200 0 77 0.16 0 95 0.00 0 103 0.16 2400 0 38 0.16 0 47 0.00 0 51 0.16 4800 0 19 ?.34 0 23 0.00 0 25 0.16 9600 0 9 ?.34 0 11 0.00 0 12 0.16 19200 0 4 ?.34 0 5 0.00 0 6 ?.99 31250 0 2 0.00 0 3 0.00 38400 0 2 0.00 0 2 8.51 p f (mhz) 4.9152 5 6 bit rate (bit/s) n n error (%)n n error (%)n n error (%) 110 2 86 0.31 2 88 ?.25 2 106 ?.44 150 1 255 0.00 2 64 0.16 2 77 0.16 300 1 127 0.00 1 129 0.16 1 155 0.16 600 0 255 0.00 1 64 0.16 1 77 0.16 1200 0 127 0.00 0 129 0.16 0 155 0.16 2400 0 63 0.00 0 64 0.16 0 77 0.16 4800 0 31 0.00 0 32 ?.36 0 38 0.16 9600 0 15 0.00 0 15 1.73 0 19 ?.34 19200 0 7 0.00 0 7 1.73 0 9 ?.34 31250 0 4 ?.70 0 4 0.00 0 5 0.00 38400 0 3 0.00 0 3 1.73 0 4 ?.34
353 table 13.4 bit rates and scbrr settings in asynchronous mode (cont) p f (mhz) 6.144 7.3728 8 bit rate (bit/s) n n error (%)n n error (%)n n error (%) 110 2 108 0.08 2 130 ?.07 2 141 0.03 150 2 79 0.00 2 95 0.00 2 103 0.16 300 1 159 0.00 1 191 0.00 1 207 0.16 600 1 79 0.00 1 95 0.00 1 103 0.16 1200 0 159 0.00 0 191 0.00 0 207 0.16 2400 0 79 0.00 0 95 0.00 0 103 0.16 4800 0 39 0.00 0 47 0.00 0 51 0.16 9600 0 19 0.00 0 23 0.00 0 25 0.16 19200 0 9 0.00 0 11 0.00 0 12 0.16 31250 0 5 2.40 0 6 5.33 0 7 0.00 38400 0 4 0.00 0 5 0.00 0 6 ?.99 p f (mhz) 9.8304 10 12 12.288 bit rate (bit/s) n n error (%) n n error (%) n n error (%) n n error (%) 110 2 174 ?.26 2 177 ?.25 2 212 0.03 2 217 0.08 150 2 127 0.00 2 129 0.16 2 155 0.16 2 159 0.00 300 1 255 0.00 2 64 0.16 2 77 0.16 2 79 0.00 600 1 127 0.00 1 129 0.16 1 155 0.16 1 159 0.00 1200 0 255 0.00 1 64 0.16 1 77 0.16 1 79 0.00 2400 0 127 0.00 0 129 0.16 0 155 0.16 0 159 0.00 4800 0 63 0.00 0 64 0.16 0 77 0.16 0 79 0.00 9600 0 31 0.00 0 32 ?.36 0 38 0.16 0 39 0.00 19200 0 15 0.00 0 15 1.73 0 19 0.16 0 19 0.00 31250 0 9 ?.70 0 9 0.00 0 11 0.00 0 11 2.40 38400 0 7 0.00 0 7 1.73 0 9 ?.34 0 9 0.00
354 table 13.4 bit rates and scbrr settings in asynchronous mode (cont) p f (mhz) 14.7456 16 19.6608 20 bit rate (bit/s) n n error (%) n n error (%) n n error (%) n n error (%) 110 3 64 0.70 3 70 0.03 3 86 0.31 3 88 ?.25 150 2 191 0.00 2 207 0.16 2 255 0.00 3 64 0.16 300 2 95 0.00 2 103 0.16 2 127 0.00 2 129 0.16 600 1 191 0.00 1 207 0.16 1 255 0.00 2 64 0.16 1200 1 95 0.00 1 103 0.16 1 127 0.00 1 129 0.16 2400 0 191 0.00 0 207 0.16 0 255 0.00 0 64 0.16 4800 0 95 0.00 0 103 0.16 0 127 0.00 0 129 0.16 9600 0 47 0.00 0 51 0.16 0 63 0.00 0 64 0.16 19200 0 23 0.00 0 25 0.16 0 31 0.00 0 32 ?.36 31250 0 14 ?.70 0 15 0.00 0 19 ?.70 0 19 0.00 38400 0 11 0.00 0 12 0.16 0 15 0.00 0 15 1.73 p f (mhz) 24 24.576 28.7 30 bit rate (bit/s) n n error (%) n n error (%) n n error (%) n n error (%) 110 3 106 ?.44 3 108 0.08 3 126 0.31 3 132 0.13 150 3 77 0.16 3 79 0.00 3 92 0.46 3 97 ?.35 300 2 155 0.16 2 159 0.00 2 186 ?.08 2 194 0.16 600 2 77 0.16 2 79 0.00 2 92 0.46 2 97 ?.35 1200 1 155 0.16 1 159 0.00 1 186 ?.08 1 194 0.16 2400 1 77 0.16 1 79 0.00 1 92 0.46 1 97 ?.35 4800 0 155 0.16 0 159 0.00 0 186 ?.08 0 194 ?.36 9600 0 77 0.16 0 79 0.00 0 92 0.46 0 97 ?.35 19200 0 38 0.16 0 39 0.00 0 46 ?.61 0 48 ?.35 31250 0 23 0.00 0 24 ?.70 0 28 ?.03 0 29 0.00 38400 0 19 ?.34 0 19 0.00 0 22 1.55 0 23 1.73
355 table 13.5 bit rates and scbrr settings in synchronous mode p f (mhz) bit rate 4 8 16 28.7 30 (bit/s) n n n n n n n n n n 110 250 2 2493 1243 249 500 2 124 2 249 3 124 3 223 3 233 1k 1 249 2 124 2 249 3 111 3 116 2.5k 1 99 1 199 2 99 2 178 2 187 5k 0 199 1 99 1 199 2 89 2 93 10k 0 99 0 199 1 99 1 178 1 187 25k 0 390 790159171174 50k 0 19 0 39 0 79 0 143 0 149 100k 09019039071074 250k 0307015029 500k 010307014 1m 0 0* 0 1 0 3 2m 0 0* 0 1 note: settings with an error of 1% or less are recommended. legend blank: no setting possible : setting possible, but error occurs * : continuous transmit/receive operation not possible
356 table 13.6 shows the maximum bit rates in asynchronous mode when the baud rate generator is being used. tables 13.7 and 13.8 list the maximum rates for external clock input. table 13.6 maximum bit rates for various frequencies with baud rate generator (asynchronous mode) settings p f (mhz) maximum bit rate (bit/s) n n 2 62500 0 0 2.097152 65536 0 0 2.4576 76800 0 0 3 93750 0 0 3.6864 115200 0 0 4 125000 0 0 4.9152 153600 0 0 8 250000 0 0 9.8304 307200 0 0 12 375000 0 0 14.7456 460800 0 0 16 500000 0 0 19.6608 614400 0 0 20 625000 0 0 24 750000 0 0 24.576 768000 0 0 28.7 896875 0 0 30 937500 0 0
357 table 13.7 maximum bit rates during external clock input (asynchronous mode) p f (mhz) external input clock (mhz) maximum bit rate (bit/s) 2 0.5000 31250 2.097152 0.5243 32768 2.4576 0.6144 38400 3 0.7500 46875 3.6864 0.9216 57600 4 1.0000 62500 4.9152 1.2288 76800 8 2.0000 125000 9.8304 2.4576 153600 12 3.0000 187500 14.7456 3.6864 230400 16 4.0000 250000 19.6608 4.9152 307200 20 5.0000 312500 24 6.0000 375000 24.576 6.1440 384000 28.7 7.1750 448436 30 7.5000 468750 table 13.8 maximum bit rates during external clock input (synchronous mode) p f (mhz) external input clock (mhz) maximum bit rate (bit/s) 8 1.3333 1333333.3 16 2.6667 2666666.7 24 4.0000 4000000.0 28.7 4.7833 4783333.3 30 5.0000 5000000.0
358 13.3 operation 13.3.1 overview for serial communication, the sci has an asynchronous mode in which characters are synchronized individually, and a synchronous mode in which communication is synchronized with clock pulses. asynchronous/synchronous mode and the transmission format are selected in the serial mode register (scsmr), as shown in table 13.9. the sci clock source is selected by the combination of the c/ a bit in the serial mode register (scsmr) and the cke1 and cke0 bits in the serial control register (scscr), as shown in table 13.10. asynchronous mode: ? data length is selectable: seven or eight bits. ? parity and multiprocessor bits are selectable, as is the stop bit length (one or two bits). the combination of the preceding selections constitutes the communication format and character length. ? in receiving, it is possible to detect framing errors (fer), parity errors (per), overrun errors (orer) and breaks. ? an internal or external clock can be selected as the sci clock source. ? when an internal clock is selected, the sci operates using the on-chip baud rate generator, and can output a serial clock signal with a frequency matching the bit rate. ? when an external clock is selected, the external clock input must have a frequency 16 times the bit rate. (the on-chip baud rate generator is not used.) synchronous mode: ? the transmission/reception format has a fixed eight-bit data length. ? in receiving, it is possible to detect overrun errors (orer). ? an internal or external clock can be selected as the sci clock source. ? when an internal clock is selected, the sci operates using the on-chip baud rate generator, and outputs a serial clock to external devices. ? when an external clock is selected, the sci operates on the input serial clock. the on-chip baud rate generator is not used.
359 table 13.9 serial mode register settings and sci communication formats scsmr settings sci communication format mode bit 7 c/ a bit 6 chr bit 5 pe bit 2 mp bit 3 stop data length parity bit multipro- cessor bit stop bit length asynchronous 0 0000 8-bit not used not used 1 bit 1 2 bits 1 0 used 1 bit 1 2 bits 1 0 0 7-bit not used 1 bit 1 2 bits 1 0 used 1 bit 1 2 bits asynchronous 0 * 1 0 8-bit not used used 1 bit (multiprocessor * 1 2 bits format) 1 * 0 7-bit 1 bit * 1 2 bits synchronous 1 **** 8-bit not used none note: asterisks (*) indicate don?-care bits. table 13.10 scsmr and scscr settings and sci clock source selection scsmr scscr settings sci transmit/receive clock mode bit 7 c/ a bit 1 cke1 bit 0 cke0 clock source sck pin function asynchronous 0 0 0 internal sci does not use the sck pin mode 1 outputs a clock with frequency matching the bit rate 1 0 external inputs a clock with frequency 16 1 times the bit rate synchronous 1 0 0 internal outputs the serial clock mode 1 1 0 external inputs the serial clock 1
360 13.3.2 operation in asynchronous mode in asynchronous mode, each transmitted or received character begins with a start bit and ends with a stop bit. serial communication is synchronized one character at a time. the transmitting and receiving sections of the sci are independent, so full-duplex communication is possible. the transmitter and receiver are both double-buffered, so data can be written and read while transmitting and receiving are in progress, enabling continuous transmitting and receiving. figure 13.2 shows the general format of asynchronous serial communication. in asynchronous serial communication, the communication line is normally held in the mark (high) state. the sci monitors the line and starts serial communication when the line goes to the space (low) state, indicating a start bit. one serial character consists of a start bit (low), data (lsb first), parity bit (high or low), and stop bit (high), in that order. when receiving in asynchronous mode, the sci synchronizes on the falling edge of the start bit. the sci samples each data bit on the eighth pulse of a clock with a frequency 16 times the bit rate. receive data is latched at the center of each bit. 0d 0 d 1 d 2 d 3 d 4 d 5 d 6 d 7 1 1 0/1 1 1 (lsb) (msb) serial data start bit 1 bit transmit/receive data 7 or 8 bits one unit of communication data (character or frame) idle (mark) state parity bit stop bit 1 or no bit 1 or 2 bits figure 13.2 data format in asynchronous communication (example: 8-bit data with parity and 2 stop bits) transmit/receive formats: table 13.11 lists the 12 communication formats that can be selected in asynchronous mode. the format is selected by settings in the serial mode register (scsmr).
361 table 13.11 serial communication formats (asynchronous mode) scsmr bits serial transmit/receive format and frame length chr pe mp stop 1 2345678 9 10 11 12 0 0 0 0 s 8-bit data stop 0 0 0 1 s 8-bit data stop stop 0 1 0 0 s 8-bit data p stop 0 1 0 1 s 8-bit data p stop stop 1 0 0 0 s 7-bit data stop 1 0 0 1 s 7-bit data stop stop 1 1 0 0 s 7-bit data p stop 1 1 0 1 s 7-bit data p stop stop 0 1 0 s 8-bit data mpb stop 0 1 1 s 8-bit data mpb stop stop 1 1 0 s 7-bit data mpb stop 1 1 1 s 7-bit data mpb stop stop legend ?: don? care bits s: start bit stop: stop bit p: parity bit mpb: multiprocessor bit clock: an internal clock generated by the on-chip baud rate generator or an external clock input from the sck pin can be selected as the sci transmit/receive clock. the clock source is selected by the c/ a bit in the serial mode register (scsmr) and bits cke1 and cke0 in the serial control register (scscr) (table 13.10). when an external clock is input at the sck pin, it must have a frequency equal to 16 times the desired bit rate. when the sci operates on an internal clock, it can output a clock signal at the sck pin. the frequency of this output clock is equal to the bit rate. the phase is aligned as shown in figure 13.3 so that the rising edge of the clock occurs at the center of each transmit data bit.
362 0 d0d1d2d3d4d5d6d70/1 1 1 1 frame figure 13.3 output clock and serial data timing (asynchronous mode) transmitting and receiving data (sci initialization (asynchronous mode)): before transmitting or receiving, clear the te and re bits to 0 in the serial control register (scscr), then initialize the sci as follows. when changing the operation mode or communication format, always clear the te and re bits to 0 before following the procedure given below. clearing te to 0 sets tdre to 1 and initializes the transmit shift register (sctsr). clearing re to 0, however, does not initialize the rdrf, per, fer, and orer flags or receive data register (scrdr), which retain their previous contents. when an external clock is used, the clock should not be stopped during initialization or subsequent operation. sci operation becomes unreliable if the clock is stopped. figure 13.4 is a sample flowchart for initializing the sci. the procedure for initializing the sci is: 1. select the clock source in the serial control register (scscr). leave rie, tie, teie, mpie, te, and re cleared to 0. if clock output is selected in asynchronous mode, clock output starts immediately after the setting is made in scscr. 2. select the communication format in the serial mode register (scsmr). 3. write the value corresponding to the bit rate in the bit rate register (scbrr) unless an external clock is used. 4. wait for at least the interval required to transmit or receive one bit, then set te or re in the serial control register (scscr) to 1. also set rie, tie, teie, and mpie as necessary. setting te or re enables the sci to use the txd or rxd pin. the initial states are the mark transmit state, and the idle receive state (waiting for a start bit).
363 initialize clear te and re bits in scscr to 0 select transmit/receive format in scsmr set value to scbrr set cke1 and cke0 bits in scscr (te and re bits are 0) wait set te and re bits in scscr to 1 and set rie, teie, and mpie bits has a 1-bit interval elapsed? end (2) (3) (1) (4) no yes note: circled numbers refer to the preceding procedure. figure 13.4 sample flowchart for sci initialization transmitting serial data (asynchronous mode): figure 13.5 shows a sample flowchart for transmitting serial data. the procedure for transmitting serial data is: 1. sci status check and transmit data write: read the serial status register (scssr), check that the tdre bit is 1, then write transmit data in the transmit data register (sctdr) and clear tdre to0. 2. to continue transmitting serial data: read the tdre bit to check whether it is safe to write (if it reads 1); if so, write data in sctdr, then clear tdre to 0. 3. to output a break at the end of serial transmission: clear the spb0dt bit in the scsptr, set the spb0io bit to 1 and then clear the te bit to 0 in scscr.
364 start transmission read tdre bit in scssr read tend bit in scssr clear te bit in scscr to 0 tend = 1? end transmission (1) (2) (3) no yes tdre = 1? write transmit data to tdr and clear tdre bit in scssr to 0 all data transmitted? no yes break output? no yes clear spb0dt to 0 and set spb0io to 1 yes no note: circled numbers refer to the preceding procedure. figure 13.5 sample flowchart for transmitting serial data
365 in transmitting serial data, the sci operates as follows: 1. the sci monitors the tdre bit in scssr. when tdre is cleared to 0, the sci recognizes that the transmit data register (sctdr) contains new data, and loads this data from sctdr into the transmit shift register (sctsr). 2. after loading the data from sctdr into sctsr, the sci sets the tdre bit to 1 and starts transmitting. if the transmit-data-empty interrupt enable bit (tie) is set to 1 in scscr, the sci requests a transmit-data-empty interrupt (txi) at this time. serial transmit data is transmitted in the following order from the txd pin: a. start bit: one 0 bit is output. b. transmit data: seven or eight bits of data are output, lsb first. c. parity bit or multiprocessor bit: one parity bit (even or odd parity) or one multiprocessor bit is output. formats in which neither a parity bit nor a multiprocessor bit is output can also be selected. d. stop bit: one or two 1 bits (stop bits) are output. e. marking: output of 1 bits continues until the start bit of the next transmit data. 3. the sci checks the tdre bit when it outputs the stop bit. if tdre is 0, the sci loads new data from sctdr into sctsr, outputs the stop bit, then begins serial transmission of the next frame. if tdre is 1, the sci sets the tend bit to 1 in scssr, outputs the stop bit, then continues output of 1 bits (marking). if the transmit-end interrupt enable bit (teie) in scscr is set to 1, a transmit-end interrupt (tei) is requested.
366 figure 13.6 shows an example of sci transmit operation in asynchronous mode. 01 1 1 0/1 0 1 tdre tend parity bit parity bit serial data start bit data stop bit start bit data stop bit idle (mark) state txi interrupt request tei interrupt request txi interrupt handler writes data to sctdr and clears tdre bit to 0 1 frame d 0 d 1 d 7 d 0 d 1 d 7 0/1 txi interrupt request figure 13.6 sci transmit operation in asynchronous mode (example: 8-bit data with parity and one stop bit) receiving serial data (asynchronous mode): figure 13.7 shows a sample flowchart for receiving serial data. the procedure for receiving serial data after enabling the sci for reception is: 1. receive error handling and break detection: if a receive error occurs, read the orer, per and fer bits in scssr to identify the error. after executing the necessary error handling, clear orer, per and fer all to 0. receiving cannot resume if orer, per or fer remain set to 1. when a framing error occurs, the rxd pin can be read to detect the break state. 2. sci status check and receive-data read: read the serial status register (scssr), check that rdrf is set to 1, then read receive data from the receive data register (scrdr) and clear rdrf to 0. the rxi interrupt can also be used to determine if the rdrf bit has changed from 0 to 1. 3. to continue receiving serial data: read the rdrf and scrdr bits and clear rdrf to 0 before the stop bit of the current frame is received.
367 start reception read orer, per, and fer bits in scssr all data received? end reception (1) no yes per, fer, orer = 1? rdrf = 1? yes yes clear the re bit in scscr to 0 no no read the rdrf bit in scssr error handling (3) (2) read reception data of scrdr and clear rdrf bit in scssr to 0 note: circled numbers refer to the preceding procedure. figure 13.7 sample flowchart for receiving serial data
368 error handling orer = 1? overrun error handling fer = 1? yes break? no framing error handling per = 1? yes parity error handling clear orer, per, and fer bits in scssr to 0 end no no no yes yes clear re bit in scscr to 0 figure 13.7 sample flowchart for receiving serial data (cont)
369 in receiving, the sci operates as follows: 1. the sci monitors the communication line. when it detects a start bit (0), the sci synchronizes internally and starts receiving. 2. receive data is shifted into scrsr in order from the lsb to the msb. 3. the parity bit and stop bit are received. after receiving these bits, the sci makes the following checks: a. parity check: the number of 1s in the receive data must match the even or odd parity setting of the o/ e bit in scsmr. b. stop bit check: the stop bit value must be 1. if there are two stop bits, only the first stop bit is checked. c. status check: rdrf must be 0 so that receive data can be loaded from scrsr into scrdr. if these checks all pass, the sci sets rdrf to 1 and stores the received data in scrdr. if one of the checks fails (receive error), the sci operates as indicated in table 13.12. note: when a receive error flag is set, further receiving is disabled. the rdrf bit is not set to 1. be sure to clear the error flags. 4. after setting rdrf to 1, if the receive-data-full interrupt enable bit (rie) is set to 1 in scscr, the sci requests a receive-data-full interrupt (rxi). if one of the error flags (orer, per, or fer) is set to 1 and the receive-data-full interrupt enable bit (rie) in scscr is also set to 1, the sci requests a receive-error interrupt (eri). table 13.12 receive error conditions and sci operation receive error abbreviation condition data transfer overrun error orer receiving of next data ends while rdrf is still set to 1 in scssr receive data not loaded from scrsr into scrdr framing error fer stop bit is 0 receive data loaded from scrsr into scrdr parity error per parity of receive data differs from even/odd parity setting in scsmr receive data loaded from scrsr into scrdr figure 13.8 shows an example of sci receive operation in asynchronous mode.
370 rdrf fer eri interrupt request generated by framing error 1 frame rxi interrupt handler reads data and clears rdrf bit to 0 rxi interrupt request 01 1 1 0/1 0 1 parity bit parity bit serial data start bit data stop bit start bit data stop bit idle (mark) state d 0 d 1 d 7 d 0 d 1 d 7 0/1 figure 13.8 sci receive operation (example: 8-bit data with parity and one stop bit) 13.3.3 multiprocessor communication the multiprocessor communication function enables several processors to share a single serial communication line. the processors communicate in asynchronous mode using a format with an additional multiprocessor bit (multiprocessor format). in multiprocessor communication, each receiving processor is addressed by a unique id. a serial communication cycle consists of an id-sending cycle that identifies the receiving processor, and a data-sending cycle. the multiprocessor bit distinguishes id-sending cycles from data-sending cycles. the transmitting processor starts by sending the id of the receiving processor with which it wants to communicate as data with the multiprocessor bit set to 1. next the transmitting processor sends transmit data with the multiprocessor bit cleared to 0. receiving processors skip incoming data until they receive data with the multiprocessor bit set to 1. when they receive data with the multiprocessor bit set to 1, receiving processors compare the data with their ids. the receiving processor with a matching id continues to receive further incoming data. processors with ids not matching the received data skip further incoming data until they again receive data with the multiprocessor bit set to 1. multiple processors can send and receive data in this way.
371 figure 13.9 shows an example of communication among processors using the multiprocessor format. receiving station a (id = 01) (id = 02) (id = 03) (id = 04) receiving station b receiving station c serial communication circuit h'01 h'aa (mpb = 0) (mpb = 1) id transmit cycle = specifies receiving station serial data transmitting station receiving station d data transmit cycle = data transmission to receiving station specified by id mpb: multiprocessor bit figure 13.9 communication among processors using multiprocessor format (example:sending data h'aa to receiving processor a) communication formats: four formats are available. parity-bit settings are ignored when the multiprocessor format is selected. for details see table 13.11. clock: see the description in the asynchronous mode section. transmitting multiprocessor serial data: figure 13.10 shows a sample flowchart for transmitting multiprocessor serial data. the procedure for transmitting multiprocessor serial data is: 1. sci status check and transmit data write: read the serial status register (scssr), check that the tdre bit is 1, then write transmit data in the transmit data register (sctdr). also set mpbt (multiprocessor bit transfer) to 0 or 1 in scssr. finally, clear tdre to 0. 2. to continue transmitting serial data: read the tdre bit to check whether it is safe to write (if it reads 1); if so, write data in sctdr, then clear tdre to 0. 3. to output a break at the end of serial transmission: set the spb0dt bit in the scsptr register to 0, set spb0io to 1, then clear te to 0 in scscr.
372 tdre = 1? write transmission data to tdr and set mpbt bit in scssr transmission ended? yes tend = 1? read tend bit in scssr break output? yes clear spb0dt to 0, set spb0io to 1 clear te bit scscr to 0 end transmission yes read tdre bit in scssr clear tdre bit to 0 no no yes no no (1) (2) (3) start transmission note: circled numbers refer to the preceding procedure. figure 13.10 sample flowchart for transmitting multiprocessor serial data
373 in transmitting serial data, the sci operates as follows: 1. the sci monitors the tdre bit in scssr. when tdre is cleared to 0 the sci recognizes that the transmit data register (sctdr) contains new data, and loads this data from sctdr into the transmit shift register (sctsr). 2. after loading the data from sctdr into sctsr, the sci sets the tdre bit to 1 and starts transmitting. if the transmit-data-empty interrupt enable bit (tie) in the scscr is set to 1, the sci requests a transmit-data-empty interrupt (txi) at this time. serial transmit data is transmitted in the following order from the txd pin: a. start bit: one 0 bit is output. b. transmit data: seven or eight bits are output, lsb first. c. multiprocessor bit: one multiprocessor bit (mpbt value) is output. d. stop bit: one or two 1 bits (stop bits) are output. e. marking: output of 1 bits continues until the start bit of the next transmit data. 3. the sci checks the tdre bit when it outputs the stop bit. if tdre is 0, the sci loads data from sctdr into sctsr, outputs the stop bit, then begins serial transmission of the next frame. if tdre is 1, the sci sets the tend bit in scssr to 1, outputs the stop bit, then continues output of 1 bits in the mark state. if the transmit-end interrupt enable bit (teie) in the scscr is set to 1, a transmit-end interrupt (tei) is requested at this time.
374 figure 13.11 shows sci transmission with the multiprocessor format. tdre tend txi interrupt request txi interrupt request tei interrupt request txi interrupt handler writes data to tdr and clears tdre bit to 0 1 frame 01 1 1 0/1 0 1 multi- processor bit serial data start bit data stop bit start bit data stop bit idle (mark) state d 0 d 1 d 7 d 0 d 1 d 7 0/1 multi- processor bit figure 13.11 sci multiprocessor transmit operation (example: 8-bit data with multiprocessor bit and one stop bit) receiving multiprocessor serial data: figure 13.12 shows a sample flowchart for receiving multiprocessor serial data. the procedure for receiving multiprocessor serial data is: 1. id receive cycle: set the mpie bit in the serial control register (scscr) to 1. 2. sci status check and compare to id reception: read the serial status register (scssr), check that rdrf is set to 1, then read data from the receive data register (scrdr) and compare with the processor? own id. if the id does not match the receive data, set mpie to 1 again and clear rdrf to 0. if the id matches the receive data, clear rdrf to 0. 3. sci status check and data receiving: read scssr, check that rdrf is set to 1, then read data from the receive data register (scrdr). 4. receive error handling and break detection: if a receive error occurs, read the orer and fer bits in scssr to identify the error. after executing the necessary error handling, clear both orer and fer to 0. receiving cannot resume if orer or fer remain set to 1. when a framing error occurs, the rxd pin can be read to detect the break state.
375 rdrf = 1? fer = 1 or orer = 1? rdrf = 1? all data received? no end reception yes set mpie bit in scscr to 1 read rdrf bit in scssr clear re bit in scscr to 0 no no (1) (2) read orer and fer bits in scssr fer = 1 or orer = 1? read rdrf bit in scssr read receive data in scrdr is id the station? id? yes read orer and fer bits in sscsr (4) no error handling yes yes (3) yes no start reception no yes read receive data in scrdr figure 13.12 sample flowchart for receiving multiprocessor serial data
376 orer = 1? break? yes framing error handling yes error handling overrun error handling yes fer = 1? clear orer and fer bits in scssr to 0 end no no no clear re bit in scscr to 0 figure 13.12 sample flowchart for receiving multiprocessor serial data (cont)
377 figures 13.13 (a) and (b) show examples of sci receive operation using a multiprocessor format. rdrf mpie rdr value id1 rxi interrupt request (multiprocessor interrupt), mpie = 0 rxi interrupt handler reads rdr data and clears rdrf bit to 0 id is not station? id, so mpie bit is set to 1 again no rxi interrupt, rdr state is maintained 01 1 1 10 1 stop bit mpb serial data start bit data (id1) data (data 1) start bit mpb stop bit idle (mark) state d 0 d 1 d 7 d 0 d 1 d 7 0 figure 13.13 (a) example of sci receive operation: own id does not match data (8-bit data with multiprocessor bit and one stop bit) rdrf mpie rdr value id1 id2 data2 01 1 1 10 1 mpb mpb serial data start bit data (id2) data (data 2) stop bit start bit stop bit idle (mark) state d 0 d 1 d 7 d 0 d 1 d 7 0 rxi interrupt request (multiprocessor interrupt), mpie = 0 rxi interrupt handler reads rdr data and clears rdrf bit to 0 id is that of station, so reception continues unchanged and data is received by the rxi interrupt handler mpie bit set to 1 again figure 13.13 (b) example of sci receive operation: own id matches data (8-bitdatawithmultiprocessor bit and one stop bit)
378 13.3.4 synchronous operation in synchronous mode, the sci transmits and receives data in synchronization with clock pulses. this mode is suitable for high-speed serial communication. the sci transmitter and receiver are independent, so full-duplex communication is possible while sharing the same clock. the transmitter and receiver are also double-buffered, so continuous transmitting or receiving is possible by reading or writing data while transmitting or receiving is in progress. figure 13.14 shows the general format in synchronous serial communication. bit 0 care don? care don? bit 1 bit 2 bit 3 bit 4 bit 5 bit 6 bit 7 lsb msb serial clock serial data ** one unit of communication data (character or frame) note: high except in continuous transmitting or receiving figure 13.14 data format in synchronous communication in synchronous serial communication, each data bit is output on the communication line from one falling edge of the serial clock to the next. data is guaranteed valid at the rising edge of the serial clock. in each character, the serial data bits are transmitted in order from the lsb (first) to the msb (last). after output of the msb, the communication line remains in the state of the msb. in synchronous mode, the sci transmits or receives data by synchronizing with the falling edge of the serial clock. communication format: the data length is fixed at eight bits. no parity bit or multiprocessor bit can be added. clock: an internal clock generated by the on-chip baud rate generator or an external clock input from the sck pin can be selected as the sci transmit/receive clock. the clock source is selected by the c/ a bit in the serial mode register (scsmr) and bits cke1 and cke0 in the serial control register (scscr). see table 13.10. when the sci operates on an internal clock, it outputs the clock signal at the sck pin. eight clock pulses are output per transmitted or received character. when the sci is not transmitting or receiving, the clock signal remains in the high state. when only receiving, the sci receives in 2-
379 character units, so a 16 pulse synchronization clock is output. to receive in 1-character units, select an external clock source. transmitting and receiving data: sci initialization (synchronous mode). before transmitting, receiving, or changing the mode or communication format, the software must clear the te and re bits to 0 in the serial control register (scscr), then initialize the sci. clearing te to 0 sets tdre to 1 and initializes the transmit shift register (sctsr). clearing re to 0, however, does not initialize the rdrf, per, fer, and orer flags and receive data register (scrdr), which retain their previous contents. figure 13.15 is a sample flowchart for initializing the sci. the procedure for initializing the sci is: 1. select the clock source in the serial control register (scscr). leave rie, tie, teie, mpie, te and re cleared to 0. 2. select the communication format in the serial mode register (scsmr). 3. write the value corresponding to the bit rate in the bit rate register (scbrr) unless an external clock is used. 4. wait for at least the interval required to transmit or receive one bit, then set te or re in the serial control register (scscr) to 1. also set rie, tie, teie and mpie. setting te and re allows use of the txd and rxd pins.
380 initialize clear te and re bits in scscr to 0 (1) has a 1-bit period elapsed? set te and re bits in scscr to 1 and set rie, tie, teie, and mpie bits set transmit/receive format in scsmr yes no set value in scbrr set rie, tie, teie, mpie, cke1, and cke0 bits in scscr (te and re are 0) end wait (2) (3) (4) figure 13.15 sample flowchart for sci initialization
381 transmitting serial data (synchronous mode): figure 13.16 shows a sample flowchart for transmitting serial data. the procedure for transmitting serial data is: 1. sci status check and transmit data write: read the serial status register (scssr), check that the tdre bit is 1, then write transmit data in the transmit data register (sctdr) and clear tdre to0. 2. to continue transmitting serial data: read the tdre bit to check whether it is safe to write (if it reads 1); if so, write data in sctdr, then clear tdre to 0. start transmission read tdre bit in scssr all data transmitted? yes no end transmission (1) (2) tdre = 1? write transmit data to sctdr and clear tdre bit in scssr to 0 yes no read tend bit in scssr tend = 1? yes no clear te bit in scscr to 0 figure 13.16 sample flowchart for serial transmitting
382 in transmitting serial data, the sci operates as follows: 1. the sci monitors the tdre bit in scssr. when tdre is cleared to 0 the sci recognizes that the transmit data register (sctdr) contains new data and loads this data from sctdr into the transmit shift register (sctsr). 2. after loading the data from sctdr into sctsr, the sci sets the tdre bit to 1 and starts transmitting. if the transmit-data-empty interrupt enable bit (tie) in scscr is set to 1, the sci requests a transmit-data-empty interrupt (txi) at this time. if clock output mode is selected, the sci outputs eight synchronous clock pulses. if an external clock source is selected, the sci outputs data in synchronization with the input clock. data is output from the txd pin in order from the lsb (bit 0) to the msb (bit 7). 3. the sci checks the tdre bit when it outputs the msb (bit 7). if tdre is 0, the sci loads data from sctdr into sctsr, then begins serial transmission of the next frame. if tdre is 1, the sci sets the tend bit in scssr to 1, transmits the msb, then holds the transmit data pin (txd) in the msb state. if the transmit-end interrupt enable bit (teie) in the scscr is set to 1, a transmit-end interrupt (tei) is requested at this time. 4. after the end of serial transmission, the sck pin is held in the high state. figure 13.17 shows an example of sci transmit operation. bit 0 bit 1 bit 7 bit 0 bit 1 bit 6 serial clock serial data transfer direction bit 7 txi interrupt handler writes data to tdr and clears tdre bit to 0 1 frame tdre tend lsb msb txi interrupt request txi interrupt request tei interrupt request figure 13.17 example of sci transmit operation
383 receiving serial data (synchronous mode): figure 13.18 shows a sample flowchart for receiving serial data. when switching from asynchronous mode to synchronous mode, make sure that orer, per, and fer are cleared to 0. if per or fer is set to 1, the rdrf bit will not be set and both transmitting and receiving will be disabled. the procedure for receiving serial data is: 1. receive error handling and break detection: if a receive error occurs, read the orer bit in scssr to identify the error. after executing the necessary error handling, clear orer to 0. transmitting/receiving cannot resume if orer remains set to 1. 2. sci status check and receive data read: read the serial status register (scssr), check that rdrf is set to 1, then read receive data from the receive data register (scrdr) and clear rdrf to 0. the rxi interrupt can also be used to determine if the rdrf bit has changed from 0 to 1. 3. to continue receiving serial data: read scrdr, and clear rdrf to 0 before the msb (bit 7) of the current frame is received.
384 read orer bit in scssr all data received? end reception no yes orer = 1? rdrf = 1? yes clear re bit in scscr to 0 no no read rdrf bit in scssr (3) (2) yes error handling (1) read receive data in scrdr and clear rdrf bit in scssr to 0 start reception end orer = 1? no clear orer bit in scssr to 0 yes overrun error handling figure 13.18 sample flowchart for serial receiving
385 in receiving, the sci operates as follows: 1. the sci synchronizes with serial clock input or output and initializes internally. 2. receive data is shifted into scrsr in order from the lsb to the msb. after receiving the data, the sci checks that rdrf is 0 so that receive data can be loaded from scrsr into scrdr. if this check is passed, the sci sets rdrf to 1 and stores the received data in scrdr. if the check is not passed (receive error), the sci operates as indicated in table 13.12. this state prevents further transmission or reception. while receiving, the rdrf bit is not set to 1. be sure to clear the error flag. 3. after setting rdrf to 1, if the receive-data-full interrupt enable bit (rie) is set to 1 in scscr, the sci requests a receive-data-full interrupt (rxi). if the orer bit is set to 1 and the receive-data-full interrupt enable bit (rie) in scscr is also set to 1, the sci requests a receive-error interrupt (eri). figure 13.19 shows an example of the sci receive operation. bit 7 bit 0 bit 7 bit 0 bit 1 bit 6 serial clock serial data transfer direction bit 7 rxi interrupt handler reads data and clears rdrf bit to 0 1 frame rxi interrupt request rxi interrupt request eri interrupt request generated by overrun error rdrf orer figure 13.19 example of sci receive operation
386 transmitting and receiving serial data simultaneously (synchronous mode): figure 13.20 shows a sample flowchart for transmitting and receiving serial data simultaneously. the procedure for setting the sci to transmit and receive serial data simultaneously is: 1. sci status check and transmit data write: read the serial status register (scssr), check that the tdre bit is 1, then write transmit data in the transmit data register (sctdr) and clear tdre to 0. the txi interrupt can also be used to determine if the tdre bit has changed from 0 to 1. 2. receive error handling: if a receive error occurs, read the orer bit in scssr to identify the error. after executing the necessary error handling, clear orer to 0. transmitting/receiving cannot resume if orer remains set to 1. 3. sci status check and receive data read: read the serial status register (scssr), check that rdrf is set to 1, then read receive data from the receive data register (scrdr) and clear rdrf to 0. the rxi interrupt can also be used to determine if the rdrf bit has changed from 0 to 1. 4. to continue transmitting and receiving serial data: read the rdrf bit and scrdr, and clear rdrf to 0 before the msb (bit 7) of the current frame is received. also read the tdre bit to check whether it is safe to write (if it reads 1); if so, write data in sctdr, then clear tdre to 0 before the msb (bit 7) of the current frame is transmitted.
387 start transmission/reception read tdre bit in scssr all data transmitted/received? end transmission/reception (1) no yes tdre = 1? write transmission data to sctdr and clear tdre bit in scssr to 0 rdrf = 1? no yes yes no read orer bit in scssr error handling (2) orer = 1? no read rdrf bit in scssr (4) yes (3) read receive data of scrdr and clear rdrf bit in scssr to 0 clear te and re bits in scscr to 0 note: when switching from transmitting or receiving to simultaneous transmitting and receiving, simultaneously clear te and re to 0, then simultaneously set te and re to 1. figure 13.20 sample flowchart for serial transmitting
388 13.4 sci interrupt sources the sci has four interrupt sources in each channel: transmit-end (tei), receive-error (eri), receive- data-full (rxi), and transmit-data-empty (txi). table 13.13 lists the interrupt sources and indicates their priority. these interrupts can be enabled and disabled by the tie, rie, and teie bits in the serial control register (scscr). each interrupt request is sent separately to the interrupt controller. txi is requested when the tdre bit in scssr is set to 1. tdre is automatically cleared to 0 when data is written in the transmit data register (sctdr). rxi is requested when the rdrf bit in scssr is set to 1. rdrf is automatically cleared to 0 when the receive data register (scrdr) is read. eri is requested when the orer, per, or fer bit in scssr is set to 1. tei is requested when the tend bit in scssr is set to 1. where the txi interrupt indicates that transmit data writing is enabled, the tei interrupt indicates that the transmit operation is complete. table 13.13 sci interrupt sources interrupt source description priority when reset is cleared eri receive error (orer, per, or fer) high rxi receive data full (rdrf) txi transmit data empty (tdre) tei transmit end (tend) low see section 4, exception handling, for information on the priority order and relationship to non- sci interrupts. 13.5 usage notes note the following points when using the sci. sctdr write and tdre flags: the tdre bit in the serial status register (scssr) is a status flag indicating loading of transmit data from sctdr into sctsr. the sci sets tdre to 1 when it transfers data from sctdr to sctsr. data can be written to sctdr regardless of the tdre bit status. if new data is written in sctdr when tdre is 0, however, the old data stored in sctdr will be lost because the data has not yet been transferred to sctsr. before writing transmit data to sctdr, be sure to check that tdre is set to 1. simultaneous multiple receive errors: table 13.14 shows the state of the scssr status flags when multiple receive errors occur simultaneously. when an overrun error occurs, the scrsr contents cannot be transferred to scrdr, so receive data is lost.
389 table 13.14 scssr status flags and transfer of receive data scssr status flags receive data transfer receive error status rdrf orer fer per scrsr scrdr overrun error 1 1 0 0 x framing error 0 0 1 0 o parity error 0 0 0 1 o overrun error + framing error 1 1 1 0 x overrun error + parity error 1 1 0 1 x framing error + parity error 0 0 1 1 o overrun error + framing error + parity error 1 1 1 1 x o: receive data is transferred from scrsr to scrdr. x: receive data is not transferred from scrsr to scrdr. break detection and processing: break signals can be detected by reading the rxd pin directly when a framing error (fer) is detected. in the break state, the input from the rxd pin consists of all 0s, so fer is set and the parity error flag (per) may also be set. in the break state, the sci receiver continues to operate, so if the fer bit is cleared to 0, it will be set to 1 again. sending a break signal: the input/output direction and level of the txd pin can be set using the spb0io and spb0dt bits in the serial port register (scsptr). use these bits to send breaks. after initialization, the pin will not function as a txd pin until the te bit is set to 1 (enabling transmission). through this period, the value of the spb0dt bit substitutes for the mark state. for this reason, the spb0io and spb0dt bits are initially set to 1 (output, high level). to send a break during serial transmission, clear the spb0dt bit to 0 (low level), then clear te to 0 (halting transmission). when the te bit is cleared to 0, the transmitter is initialized without regard to the current transmission status, and 0 is output from the txd pin. receive error flags and transmitter operation (synchronous mode only): when a receive error flag (orer, per, or fer) is set to 1, the sci will not start transmitting even if tdre is set to 1. be sure to clear the receive error flags to 0 before starting to transmit. note that clearing re to 0 does not clear the receive error flags. receive data sampling timing and receive margin in asynchronous mode: in asynchronous mode, the sci operates on a base clock of 16 times the transfer rate frequency. in receiving, the sci synchronizes internally with the falling edge of the start bit, which it samples on the base clock. receive data is latched on the rising edge of the eighth base clock pulse (figure 13.21).
390 0 1 2 3 4 5 6 7 8 9 10111213 1415 0 1 2 3 4 5 6 7 8 9 10111213 1415 0 1 2 3 4 5 base clock receive data (rxd) synchro- nization sampling timing data sampling timing 8 clock cycles 16 clock cycles start bit ?.5 clock cycles +7.5 clock cycles d0 d1 figure 13.21 receive data sampling timing in asynchronous mode the receive margin in the asynchronous mode can therefore be expressed as shown in equation 1. equation 1: m = 0.5 ? 1 2n d ?0.5 n ?(l ?0.5)f ? (1 + f) 100% where: m = receive margin (%) n = ratio of clock frequency to bit rate (n = 16) d = clock duty cycle (d = 0?.0) l = frame length (l = 9?2) f = absolute deviation of clock frequency from equation (1), if f = 0 and d = 0.5, the receive margin is 46.875%, as shown in equation 2. equation 2: m = (0.5 ?1/(2 16)) 100% = 46.875% this is a theoretical value. a reasonable margin to allow in system designs is 20?0%.
391 cautions on use of clock synchronous external clock mode: ? set te = re = 1 only when the external clock sck is 1. ? do not set te = re = 1 until at least four peripheral operating clock cycles after the external clock sck has changed from 0 to 1. ? when receiving, rdrf is 1 when re is set to zero 2.5?.5 peripheral operating clock cycles after the rising edge of the rxd d7 bit sck input, but it cannot be copied to scrdr. caution on use of clock synchronous internal clock mode: when receiving, rdrf is 1 when re is set to zero 1.5 peripheral operating clock cycles after the rising edge of the rxd d7 bit sck output, but it cannot be copied to scrdr.
392
393 section 14 smart card interface 14.1 overview as an added serial communications interface function, the sci supports an ic card (smart card) interface that conforms to the iso/iec standard 7816-3 for identification of cards. register settings are used to switch between the ordinary serial communication interface and the smart card interface. 14.1.1 features the smart card interface has the following features: asynchronous mode ? data length: eight bits ? parity bit generation and check ? receive mode error signal detection (parity error) ? transmit mode error signal detection and automatic re-transmission of data ? supports both direct convention and inverse convention bit rate can be selected using on-chip baud rate generator. three types of interrupts: transmit-data-empty, receive-data-full, and communication-error interrupts are requested independently.
394 14.1.2 block diagram figure 14.1 shows a block diagram of the smart card interface. rxd txd sck sci scbrr scscr scsmr sctdr sctsr scrdr scrsr scsptr scscmr scssr parity generation parity check clock external clock module data bus internal data bus p f p f /4 p f /16 p f /64 txi rxi eri bus interface baud rate generator transmit/ receive control scscmr: scrsr: scrdr: sctsr: sctdr: scsmr: scscr: scssr: scbrr: scsptr: smart card mode register receive data register receive data register transmit shift register transmit data register serial mode register serial control register serial status register bit rate register serial port register figure 14.1 smart card interface block diagram
395 14.1.3 pin configuration table 14.1 summarizes the smart card interface pins. table 14.1 sci pins pin name abbreviationinput/output function serial clock pin sck output clock output receive data pin rxd input receive data input transmit data pin txd output transmit data output 14.1.4 register configuration table 14.2 summarizes the registers used by the smart card interface. the scsmr, scbrr, scscr, sctdr, and scrdr registers are the same as in the ordinary sci function. they are described in section 13, serial communication interface. table 14.2 registers name abbreviationr/w initial value* 3 address access size serial mode register scsmr r/w h'00 h'fffffe80 8 bit rate register scbrr r/w h'ff h'fffffe82 8 serial control register scscr r/w h'00 h'fffffe84 8 transmit data register sctdr r/w h'ff h'fffffe86 8 serial status register scssr r/(w)* 1 h'84 h'fffffe88 8 receive data register scrdr r h'00 h'fffffe8a 8 smart card mode register scscmr r/w * 2 h'fffffe8c 8 notes: 1. only 0 can be written, to clear the flags. 2. bits 0, 2, and 3 are cleared. the value of the other bits is undefined. 3. initialized by a power-on or manual reset. 14.2 register descriptions this section describes the registers added for the smart card interface and the bits whose functions are changed.
396 14.2.1 smart card mode register (scscmr) the smart card mode register (scscmr) is an 8-bit read/write register that selects smart card interface functions. scsmr bits 0, 2, and 3 are initialized to 0 by a reset and in standby mode. bit: 7 6 5 4 3 2 1 0 bit name: sdir sinv smif initial value: 0 0 0 r/w: r r r r r/w r/w r r/w bits 7 to 4 and 1reserved: an undefined value will be returned if these bits are read. bit 3smart card data transfer direction (sdir): selects the serial/parallel conversion format. bit 3: sdir description 0 contents of sctdr are transferred lsb first, receive data is stored in scrdr lsb first. (initial value) 1 contents of sctdr are transferred msb first, receive data is stored in scrdr msb first. bit 2smart card data inversion (sinv): specifies whether to invert the logic level of the data. this function is used in combination with bit 3 for transmitting and receiving with an inverse convention card. sinv does not affect the logic level of the parity bit. see section 14.3.4, register settings, for information on how parity is set. bit 2: sinv description 0 contents of sctdr are transferred unchanged, receive data is stored in scrdr unchanged. (initial value) 1 contents of sctdr are inverted before transfer, receive data is inverted before storage in scrdr. bit 0smart card interface mode select (smif): enables the smart card interface function. bit 0 : smif description 0 smart card interface function disabled (initial value) 1 smart card interface function enabled
397 14.2.2 serial status register (scssr) in the smart card interface mode, the function of scssr bit 4 is changed. the setting conditions for bit 2, the tend bit, are also changed. bit: 7 6 5 4 3 2 1 0 bit name: tdre rdrf orer fer/ers per tend mpb mpbt initial value: 1 0 0 0 0 1 0 0 r/w: r/(w)* r/(w)* r/(w)* r/(w)* r/(w)* r r r/w note: only 0 can be written, to clear the flag. bits 7 to 5: these bits have the same function as in the ordinary sci. see section 13, serial communication interface, for more information. bit 4error signal status (ers): in the smart card interface mode, bit 4 indicates the status of the error signal returned from the receiving side during transmission. the smart card interface cannot detect framing errors. bit 4: ers description 0 receiving ended normally with no error signal. (initial value) ers is cleared to 0 when the chip is reset or enters standby mode, or when software reads ers after it has been set to 1, then writes 0 in ers. 1 an error signal indicating a parity error was transmitted from the receiving side. ers is set to 1 if the error signal sampled is low. note: the ers flag maintains its status even when the te bit in scscr is cleared to 0.
398 bits 3 to 0: these bits have the same function as in the ordinary sci. see section 13, serial communication interface, for more information. the setting conditions for bit 2, the transmit end bit (tend), are changed as follows. bit 2: tend description 0 transmission is in progress. tend is cleared to 0 when software reads tdre after it has been set to 1, then writes 0 in tdre, or when data is written in sctdr. 1 end of transmission. (initial value) tend is set to 1 when: the chip is reset or enters standby mode, the te bit in scscr is 0 and the fer/ers bit is also 0, the c/ a bit in scsmr is 0, and tdre = 1 and fer/ers = 0 (normal transmission) 2.5 etu after a one-byte serial character is transmitted, or the c/ a bit in scsmr is 1, and tdre = 1 and fer/ers = 0 (normal transmission) 1.0 etu after a one-byte serial character is transmitted. note: etu is an abbreviation of elementary time unit, which is the period for the transfer of 1 bit. 14.3 operation 14.3.1 overview the primary functions of the smart card interface are described below. 1. each frame consists of 8 data bits and 1 parity bit. 2. during transmission, the card leaves a guard time of at least 2 etu (elementary time units: the period for 1 bit to transfer) from the end of the parity bit to the start of the next frame. 2. during reception, the card outputs an error signal low level for 1 etu after 10.5 etu has elapsed from the start bit if a parity error was detected. 4. during transmission, it automatically transmits the same data after allowing at least 2 etu from the time the error signal is sampled. 5. the specification complies with iso/ice7816-3, but the only type of data transmission protocol supported is protocol type t = 0 : asynchronous double-character transmission protocol.
399 14.3.2 pin connections figure 14.2 shows the pin connection diagram for the smart card interface. during communication with an ic card, transmission and reception are both carried out over the same data transfer line, so connect the txd and rxd pins on the chip. pull up the data transfer line to the power supply v cc side with a resistor. when using the clock generated by the smart card interface on an ic card, input the sck pin output to the ic cards clk pin. this connection is not necessary when the internal clock is used on the ic card. use the chips port output as the reset signal. apart from these pins, the power and ground pin connections are usually also required. note: when the ic card is not connected and both re and te are set to 1, closed communication is possible and auto-diagnosis can be performed. lsi txd io clk rst rxd sck px (port) clock line data line reset line ic card connected device v cc figure 14.2 pin connection diagram for the smart card interface
400 14.3.3 data format figure 14.3 shows the data format for the smart card interface. in this mode, parity is checked every frame while receiving and error signals sent to the transmitting side whenever an error is detected so that data can be re-transmitted. during transmission, error signals are sampled and data re-transmitted whenever an error signal is detected. ds d0 d1 d2 d3 d4 d5 d6 d7 dp with no parity error transmitting station output ds d0 d1 d2 d3 d4 d5 d6 d7 dp de with parity error transmitting station output receiving station output ds: d0?7: dp: de: start bit data bits parity bit error signal figure 14.3 data format for smart card interface
401 the operating sequence is: 1. the data line is high impedance when not in use and is fixed high with a pull-up resistor. 2. the transmitting side starts one frame of data transmission. the data frame starts with a start bit (ds, low level). the start bit is followed by eight data bits (d0Cd7) and a parity bit (dp). 3. on the smart card interface, the data line returns to high impedance after this. the data line is pulled high with a pull-up resistor. 4. the receiving side checks parity. when the data is received normally with no parity errors, the receiving side then waits to receive the next data. when a parity error occurs, the receiving side outputs an error signal (de, low level) and requests re-transfer of data. the receiving station returns the signal line to high impedance after outputting the error signal for a specified period. the signal line is pulled high with a pull-up resistor. 5. the transmitting side transmits the next frame of data unless it receives an error signal. if it does receive an error signal, it returns to step 2 to re-transmit the erroneous data. 14.3.4 register settings table 14.3 shows the bit map of the registers that the smart card interface uses. bits shown as 1 or 0 must be set to the indicated value. the settings for the other bits are described below. table 14.3 register settings for the smart card interface registe r address bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 scsmr h'fffffe80 c/ a 01o/ e 1 0 cks1 cks0 scbrr h'fffffe82 brr7 brr6 brr5 brr4 brr3 brr2 brr1 brr0 scscr h'fffffe84 tie rie te re 0 0 cke1 cke0 sctdr h'fffffe86 tdr7 tdr6 tdr5 tdr4 tdr3 tdr2 tdr1 tdr0 scssr h'fffffe88 tdre rdrf orer fer/ ers per tend 0 0 scrdr h'fffffe8a rdr7 rdr6 rdr5 rdr4 rdr3 rdr2 rdr1 rdr0 scscmr h'fffffe8c sdir sinv smif note: dashes indicate unused bits.
402 1. setting the serial mode register (scsmr): set the o/ e bit to 0 when the ic card uses the direct convention or to 1 when it uses the inverse convention. select the on-chip baud rate generator clock source with the cks1 and cks0 bits (see section 14.3.5, clock). when bit 7 (c/a) of the serial mode register (scsmr) is set to 1 (default value : 1), bit 2 (tend) of the serial status register (scssr) is simply set to 1 (txi interrupt request) 1 etu (default value : 2.5 etu) after transmission of a 1-byte character, and 11 etu continuous transmission (block transfer protocol) cannot be performed. 2. setting the bit rate register (scbrr): set the bit rate. see section 14.3.5, clock, to see how to calculate the set value. 3. setting the serial control register (scscr): the tie, rie, te and re bits function as they do for the ordinary sci. see section 13, serial communication interface, for more information. the cke0 bit specifies the clock output. when no clock is output, set 0; when a clock is output, set 1. 4. setting the smart card mode register (scscmr): the sdir and sinv bits are both set to 0 for ic cards that use the direct convention and both to 1 when the inverse convention is used. the smif bit is set to 1 for the smart card interface. figure 14.4 shows sample waveforms for register settings of the two types of ic cards (direct convention and inverse convention) and their start characters. in the direct convention type, the logical 1 level is state z, the logical 0 level is state a, and communication is lsb first. the start character data is h'3b. the parity bit is even (from the smart card standards), and thus a 1. in the inverse convention type, the logical 1 level is state a, the logical 0 level is state z, and communication is msb first. the start character data is h'3f. the parity bit is even (from the smart card standards), and thus a 0, which corresponds to state z. only data bits d7Cd0 are inverted by the sinv bit. to invert the parity bit, set the o/ e bit in scsmr to odd parity mode. this applies to both transmission and reception.
403 ds d0 d1 d2 d3 d4 d5 d6 d7 dp a (z) z z a z z z a a z (z) state a. direct convention (sdir, sinv, and o/ e are all 0) ds d7 d6 d5 d4 d3 d2 d1 d0 dp a (z) z z a a a a a a z (z) state b. inverse convention (sdir, sinv, and o/ e are all 1) figure 14.4 waveform of start character 14.3.5 clock only the internal clock generated by the on-chip baud rate generator can be used as the communication clock in the smart card interface. the bit rate for the clock is set by the bit rate register (scbrr) and the cks1 and cks0 bits in the serial mode register (scsmr), and is calculated using the equation below. table 14.5 shows sample bit rates. if clock output is then selected by setting cke0 to 1, a clock with a frequency 372 times the bit rate is output from the sck0 pin. b = 10 6 1488 2 2n? (n + 1) f p where: n = value set in scbrr (0 n 255) b = bit rate (bit/s) p f = peripheral module operating frequency (mhz)* n = 0C3 (table 14.4)
404 table 14.4 relationship of n to cks1 and cks0 n cks1 cks0 000 101 210 311 table 14.5 examples of bit rate b (bit/s) for scbrr settings (n = 0) p f (mhz) n 7.1424 10.00 10.7136 13.00 14.2848 16.00 18.00 0 9600.0 13440.9 14400.0 17473.1 19200.0 21505.4 24193.5 1 4800.0 6720.4 7200.0 8736.6 9600.0 10752.7 12096.8 2 3200.0 4480.3 4800.0 5824.4 6400.0 7168.5 8064.5 note: the bit rate is rounded to two decimal places. calculate the value to be set in the bit rate register (scbrr) from the operating frequency and the bit rate. n is an integer in the range 0 n 255, specifying a smallish error. n = 10 6 ?1 1488 2 2n? b f p table 14.6 examples of scbrr settings for bit rate b (bit/s) (n = 0) f (mhz) (9600 bits/s) 7.1424 10.00 10.7136 13.00 14.2848 16.00 18.00 n error n error n error n error n error n error n error 0 0.00 1 30.00 1 25.00 1 8.99 1 0.00 1 12.01 2 15.99
405 table 14.7 maximum bit rates for frequencies (smart card interface mode) p f (mhz) maximum bit rate (bit/s) n n 7.1424 9600 0 0 10.00 13441 0 0 10.7136 14400 0 0 13.00 17473 0 0 14.2848 19200 0 0 16.00 21505 0 0 18.00 24194 0 0 the bit rate error is found as follows: error(%) = ( 10 6 ?1) 100 1488 2 2n? b (n + 1) f p table 14.8 shows the relationship between transmit/receive clock register set values and output states on the smart card interface. table 14.8 register set values and sck pin register value sck pin setting smif c/ a cke1 cke0 output state 1* 1 1000 port determined by setting of port register spb1io and spb1dt bits 1001 sck (serial clock) output state 2* 2 1100 low output low output state 1101 sck (serial clock) output state 3* 2 1110 high output high output state 1111 sck (serial clock) output state notes: 1. the sck output state changes as soon as the cke0 bit is modified. the cke1 bit should be cleared to 0. 2. the clock duty remains constant despite stopping and starting of the clock by modification of the cke0 bit.
406 14.3.6 data transmission and reception initialization: initialize the sci using the following procedure before sending or receiving data. initialization is also required for switching from transmit mode to receive mode or from receive mode to transmit mode. figure 14.5 shows a flowchart of the initialization process. 1. clear te and re in the serial control register (scscr) to 0. 2. clear error flags fer/ers, per, and orer to 0 in the serial status register (scssr). 3. set the c/ a bit, parity bit (o/ e bit), and baud rate generator select bits (cks1 and cks0 bits) in the serial mode register (scsmr). at this time also clear the chr and mp bits to 0 and set the stop and pe bits to 1. 4. set the smif, sdir, and sinv bits in the smart card mode register (scscmr). when the smif bit is set to 1, the txd and rxd pins both switch from ports to sci pins and become high impedance. 5. set the value corresponding to the bit rate in the bit rate register (scbrr). 6. set the clock source select bits (cke1 and cke0 bits) in the serial control register (scscr). clear the tie, rie, te, re, mpie, and teie bits to 0. when the cke0 bit is set to 1, a clock is output from the sck0 pin. 7. after waiting at least 1 bit, set the tie, rie, te, and re bits in scscr. do not set the te and re bits simultaneously unless performing auto-diagnosis.
407 initialize clear te and re bits in scscr to 0 set value in scbrr clear scssr? fer/ers, per and orer flags to 0 wait set scscr? tie, rie, te, and re bits has a 1-bit interval elapsed? end (2) set scscmr? o/ e bit to parity and set cks1 and cks0 bits to the clock (3) set scscr? cke1 and cke0 bits to the clock and clear tie, rie, te, re, mpie, and teie bits to 0 (6) (5) (4) (1) (7) no yes set scscmr's smif, sdir, and sinv bits figure 14.5 initialization flowchart (example)
408 serial data transmission: the handling procedures in the smart card mode differ from ordinary sci processing because data is retransmitted when an error signal is sampled during a data transmission. this results in the transmission processing flowchart shown in figure 14.6. 1. initialize the smart card interface mode as described in initialization above. 2. check that the fer/ers bit in scssr is cleared to 0. 3. repeat steps 2 and 3 until the tend flag in scssr is set to 1. 4. write the transmit data into sctdr, clear the tdre flag to 0 and start transmitting. the tend flag will be cleared to 0. 5. to transmit more data, return to step 2. 6. to end transmission, clear the te bit to 0. this processing can be interrupted. when the tie bit is set to 1 and interrupt requests are enabled, a transmit-data-empty interrupt (txi) will be requested when the tend flag is set to 1 at the end of the transmission. when the rie bit is set to 1 and interrupt requests are enabled, a communication error interrupt (eri) will be requested when the ers flag is set to 1 when an error occurs in transmission. see interrupt operation below for more information.
409 start end transmission start transmission initialize write transmit data in sctdr and clear tdre flag in scssr to 0 (1) clear te bit in scscr to 0 (6) error handling (2) fer/ers = 0? tend = 1? yes yes yes yes no no all data transmitted? no tend = 1? no error handling fer/ers = 0? yes no (4) (5) (3) figure 14.6 transmission flowchart
410 serial data reception: the handling procedures in the smart card mode are the same as in ordinary sci processing. the reception processing flowchart is shown in figure 14.7. 1. initialize the smart card interface mode as described above in initialization and in figure 14.5. 2. check that the orer and per flags in scssr are cleared to 0. if either flag is set, clear both to 0 after performing the appropriate error handling procedures. 3. repeat steps 2 and 3 until the rdrf flag is set to 1. 4. read the receive data from scrdr. 5. to receive more data, clear the rdrf flag to 0 and return to step 2. 6. to end reception, clear the re bit to 0. this processing can be interrupted. when the rie bit is set to 1 and interrupt requests are enabled, a receive-data-full interrupt (rxi) will be requested when the rdrf flag is set to 1 at the end of the reception. when an error occurs during reception and either the orer or per flag is set to 1, a communication error interrupt (eri) will be requested. see interrupt operation, below, for more information. the received data will be transferred to scrdr even when a parity error occurs during reception and per is set to 1, so this data can still be read.
411 start end reception start reception initialize write receive data from scrdr and clear rdrf flag in scssr to 0 (1) clear re bit in scscr to 0 (6) error handling (2) orer = 0 and per = 0? rdrf = 1? yes yes yes no no all data received? no (4) (5) (3) figure 14.7 reception flowchart (example)
412 switching modes: when switching from receive mode to transmit mode, check that the receive operation is completed before starting initialization and setting re to 0 and te to 1. the rdrf, per, and orer flags can be used to check if reception is completed. when switching from transmit mode to receive mode, check that the transmit operation is completed before starting initialization and setting te to 0 and re to 1. the tend flag can be used to check if transmission is completed. interrupt operation: in the smart card interface mode, there are three types of interrupts: transmit-data-empty (txi), communication error (eri) and receive-data-full (rxi). in this mode, the transmit-end interrupt (tei) cannot be requested. set the tend flag in scssr to 1 to request a txi interrupt. set the rdrf flag in scssr to 1 to request an rxi interrupt. set the orer, per, or fer/ers flag in scssr to 1 to request an eri interrupt (table 14.9). table 14.9 smart card mode operating status and interrupt sources mode status flag mask bit interrupt source transmit mode normal tend tie txi error fer/ers rie eri receive mode normal rdrf rie rxi error per, orer rie eri 14.4 usage notes when the sci is used as a smart card interface, be sure that all criteria in sections 14.4.1 and 14.4.2 are applied. 14.4.1 receive data timing and receive margin in asynchronous mode in asynchronous mode, the sci runs on a basic clock with a frequency of 372 times the transfer rate. during reception, the sci samples the fall of the start bit using the base clock to achieve internal synchronization. receive data is latched internally on the rising edge of the 186th basic clock cycle (figure 14.8).
413 0 185 371 0 185 371 0 base clock receive data (rxd) synchro- nization sampling timing data sampling timing 186 clock cycles 372 clock cycles start bit d0 d1 figure 14.8 receive data sampling timing in smart card mode the receive margin is found from the following equation: for smart card mode: m = (0.5 ? ) 1 2n d ?0.5 n ?(l ?0.5)f ? (1 + f) 100% where: m = receive margin (%) n = ratio of bit rate to clock (n = 372) d = clock duty (d = 0 to 1.0) l = frame length (l = 10) f = absolute value of clock frequency deviation using this equation, the receive margin when f = 0 and d = 0.5 is as follows: m = (0.5 C 1/2 372) 100% = 49.866%
414 14.4.2 retransmission (receive and transmit modes) retransmission by the sci in receive mode: figure 14.9 shows the retransmission operation in the sci receive mode. 1. when the received parity bit is checked and an error is found, the per bit in scssr is automatically set to 1. if the rie bit in scscr is enabled at this time, an eri interrupt is requested. be sure to clear the per bit before the next parity bit is sampled. 2. the rdrf bit in scssr is not set in the frame that caused the error. 3. when the received parity bit is checked and no error is found, the per bit in scssr is not set. 4. when the received parity bit is checked and no error is found, reception is considered to have been completed normally and the rdrf bit in scssr is automatically set to 1. if the rie bit in scscr is enabled at this time, an rxi interrupt is requested. 5. when a normal frame is received, the pin maintains a three-state status when it transmits the error signal. d0 ds d2 d1 d4 d3 d6 d5 dp de d7 d0 ds d2 d1 d4 d3 d6 d5 dp (de) d7 d0 ds d2 d1 d4 d3 nth transfer frame rdrf per 2 1 4 5 3 retransmitted frame transfer frame n + 1 figure 14.9 retransmission in sci receive mode
415 retransmission by the sci in transmit mode: figure 14.10 shows the retransmission operation in the sci transmit mode. 1. after transmission of one frame is completed, the fer/ers bit in scssr is set to 1 when a error signal is returned from the receiving side. if the rie bit in scscr is enabled at this time, an eri interrupt is requested. be sure to clear the fer/ers bit before the next parity bit is sampled. 2. the tend bit in scssr is not set in the frame that received the error signal that indicated the error. 3. the fer/ers bit in scsr is not set when no error signal is returned from the receiving side. 4. when no error signal is returned from the receiving side, the tend bit in scssr is set to 1 when the transmission of the frame that includes the retransmission is considered completed. if the tie bit in scscr is enabled at this time, a txi interrupt will be requested. d0 ds d2 d1 d4 d3 d6 d5 dp de d7 d0 ds d2 d1 d4 d3 d6 d5 dp (de) d7 d0 ds d2 d1 d4 d3 nth transfer frame tend fer/ers transfer from tdr to trs transfer from tdr to trs transfer from tdr to trs 1 2 4 3 retransmitted frame transfer frame n + 1 tdre figure 14.10 retransmission in sci transmit mode
416
417 section 15 i/o ports 15.1 overview the has an on-chip 8-bit general-purpose i/o port and an on-chip i/o port for the serial communication interface (sci). 15.1.1 features the general-purpose i/o port has the following features: direction of each bit of the 8-bit i/o port can be set independently when each bit is set for input mode, it is possible to set each bit for independent pull-up ports can be used as i/o ports or as data bus lines, for a maximum data bus width of 32 bits, by setting the porten bit in bus control register 2 (bcr2) the sci i/o port has the following features: when the i/o port is set to output and the sci is not enabled, data can be output. this allows transmission of the break status. sck pin control is also possible. the value of the rxd pin can be read at any time. this enables break detection. 15.1.2 block diagram figure 15.1 shows a block diagram of the 8-bit general-purpose i/o port. port7 (i/o)/d23 (i/o) port6 (i/o)/d22 (i/o) port5 (i/o)/d21 (i/o) port4 (i/o)/d20 (i/o) port3 (i/o)/d19 (i/o) port2 (i/o)/d18 (i/o) port1 (i/o)/d17 (i/o) port0 (i/o)/d16 (i/o) 8-bit port figure 15.1 8-bit i/o port
418 figures 15.2 to 15.4 show block diagrams of the sci i/o port. internal data bus serial clock output clock output enable sci * serial clock input clock input enable r spb1io sptrw reset c q q d r spb1dt sptrw reset md0/sck c d sptrw: sptr write sptrr: sptr read sptrr note: signals that set the sck pin function to internal clock output or external clock input as specified by the cke0 and cke1 bits in scscr, and the c/ a bit in scsmr. figure 15.2 sci i/o port: md0/sck pin
419 internal data bus transmit enable sci serial transmit data r spb0io sptrw reset c q q d r spb0dt sptrw reset md1/txd c d sptrw: sptr write figure 15.3 sci i/o port: md1/txd pin sci serial receive data internal data bus sptrr md2/rxd sptrr: sptr read figure 15.4 sci i/o port: md2/rxd pin
420 15.1.3 pin configuration table 15.1 shows the pin configuration of the 8-bit general-purpose i/o port. table 15.1 pin configuration pin signal i / o function port 7 port7 i/o i/o port port 6 port6 i/o i/o port port 5 port5 i/o i/o port port 4 port4 i/o i/o port port 3 port3 i/o i/o port port 2 port2 i/o i/o port port 1 port1 i/o i/o port port 0 port0 i/o i/o port table 15.2 shows the pin configuration of the sci i/o port. table 15.2 pin configuration pin signal i / o function serial transmission txd o serial data transmission and break status transmission serial reception rxd i serial data reception and break status detection serial clock sck i/o serial clock input/output and i/o port note: these pins function as mode input pins md0Cmd2 after a power-on reset. they are made to function as serial pins by performing sci operation settings with the te, re, ckei, and cke0 bits in scscr and the c/ a bit in scsmr. break status transmission and detection can be performed by means of the scis scsptr register.
421 15.1.4 register configuration table 15.3 shows the configuration of the two registers of the 8-bit general-purpose i/o port (pctr and pdtr) and the one register of the sci i/o port (scsptr). table 15.3 register configuration register symbol r/w initial value* 1 address access size port control register pctr r/w h'0000 h'ffffff76 16 port data register pdtr r/w undefined h'ffffff78 8 serial port register scsptr r/w * 2 h'ffffff7c 8 notes: 1. initialized by a power-on reset. 2. bits other than 2 and 0 are initialized to h'00. bits 2 and 0 are undefined. 15.2 register descriptions 15.2.1 port control register (pctr) bit: 15 14 13 12 11 10 9 8 bit name: pb7 pup pb7 io pb6 pup pb6 io pb5 pup pb5 io pb4 pup pb4 io initial value: 0 0 0 0 0 0 0 0 r/w: r/w r/w r/w r/w r/w r/w r/w r/w bit: 7 6 5 4 3 2 1 0 bit name: pb3 pup pb3 io pb2 pup pb2 io pb1 pup pb1 io pb0 pup pb0 io initial value: 0 0 0 0 0 0 0 0 r/w: r/w r/w r/w r/w r/w r/w r/w r/w the port control register (pctr) is a 16-bit read/write register that controls the input/output direction and pull-up for each bit in the 8-bit port. as the initial value of the port data register (pdr) is undefined, all the bits in the 8-bit port should be set to output with pctr after writing a value to the pdtr register. pctr is initialized to h'0000 by a power-on reset. it is not initialized by a manual reset or in standby mode, and retains its contents.
422 bit 2n + 1 (n = 0C7): port pull-up control (pbnpup): controls the pull-up of each bit in the 8-bit port by means of built-in resistors. this setting is valid even if the port pin is set to output by the pbnio bit. therefore, to avoid unnecessary power consumption and ensure the reliability of the chip, a pull-up setting should not be made when the corresponding port pin has been set to output. bit 2n + 1: pbnpup description 0 bit n (n = 0C7) of the 8-bit port is pulled up. (initial value) 1 bit n (n = 0C7) of the 8-bit port is not pulled up. bit 2n (n = 0C7)port i/o control (pbndir): controls whether each bit of 8-bit port is an input or an output. bit 2n: pbnio description 0 bit n (n = 0C7) of the 8-bit port is an input. (initial value) 1 bit n (n = 0C7) of the 8-bit port is an output. 15.2.2 port data register (pdtr) the port data register (pdtr) is an 8-bit read/write register used as data latches for each bit of the 8-bit port. when a bit is set to be used as an output, the value written into pdtr is output from the external pin. when a value is read from pdtr, the external pin value sampled on the external bus clock is returned. pdtr is not initialized by a power-on reset or manual reset, or in standby mode, and it retains its contents. however, if pdtr is read when a bus release request is issued (when breq is asserted), its value may not be read correctly. therefore, breq should not be asserted when reading pdtr. bit: 7 6 5 4 3 2 1 0 bit name: pb7dt pb6dt pb5dt pb4dt pb3dt pb2dt pb1dt pb0dt initial value: r/w: r/w r/w r/w r/w r/w r/w r/w r/w
423 15.2.3 serial port register (scsptr) the serial port register (scsptr) is an 8-bit register that the cpu can always read and write. it controls i/o and data of the port multiplexed with the serial communication interface (sci) pins. input data can be read from the rxd pin and output data can be transmitted to the txd pin; this controls breaks for serial transmission and reception. in addition, sck pin data reading and output data writing can be performed by means of bits 3 and 2. all scsptr bits except bits 2 and 0 are initialized to 0 by a power-on reset; the value of bits 2 and 0 is undefined. scsptr is not initialized by a manual reset or in standby mode, and it retains its contents. bit: 7 6 5 4 3 2 1 0 bit name: spb1io spb1dt spb0io spb0dt initial value: 0 0 0 0 0 0 r/w: r r r r r/w r/w r/w r/w bits 7 to 4reserved: these bits always read 0. the write value should always be 0. bit 3serial port clock port i/o (spb1io): specifies serial port sck pin input/output. when the sck pin is actually set as a port output pin and outputs the value set by the spb1dt bit, the c/ a bit in scsmr and the cke1 and cke0 bits in scscr should be cleared to 0. bit 3: spb1io description 0 the spb1dt value is not output to the sck pin. (initial value) 1 the spb1dt bit value is output to the sck pin. bit 2serial port clock port data (spb1dt): specifies the serial port sck pin input/output data. input or output is specified by the spb1io bit (see the description of spb1io for details). when output is specified, the value of the spb1dt bit is output to the sck pin. the sck pin value is read from the spb1dt bit regardless of the value of the spb1io bit. the initial value of this bit after a power-on reset is undefined. bit 2: spb1dt description 0 i/o data level is low. (initial value) 1 i/o data level is high.
424 bit 1serial port break i/o (spb0io): specifies the serial port txd pin output condition. when the txd pin is actually set as a port output pin and outputs the value set by the spb0dt bit, the te bit in scscr should be cleared to 0. bit 1: spb0io description 0 the spb0dt bit value is not output to the txd pin. (initial value) 1 the spb0dt bit value is output to the txd pin. bit 0Cserial port break data (spb0dt): specifies serial port rxd pin input data and txd pin output data. the txd pin output condition is set with the spb0io bit (see the description of spb0io above). when the txd pin is set as an output, the value of the spb0dt bit is output to the txd pin. the rxd pin value is always read from the spb0dt bit, regardless of the value of the spb0io bit. the initial value of this bit after a power-on reset is undefined. bit 0 : spb0dt description 0 i/o data level is low. (initial value) 1 i/o data level is high.
425 section 16 electrical characteristics (-sh7708, sh7708s-) 16.1 absolute maximum ratings table 16.1 absolute maximum ratings item symbol ratings units power supply voltage v cc C0.3 to 4.6 v input voltage v in C0.3 to v cc + 0.3 v operating temperature t opr C20 to 75 c storage temperature t str C55 to 125 c note: operating the sh7708 series above maximum ratings can damage or destroy it.
426 16.2 dc characteristics table 16.2 dc characteristics (ta = C20 to 75c) item symbolmin type max unitremarks power supply voltage v cc 3.0 3.3 3.6 v in normal operation, sleep mode, and standby mode 2.0 3.3 3.6 rtc operating voltage in standby mode current normal operation i cc 195* 1 ma v cc = 3.3 v 100* 2 * 1 : 60 mhz (p? = 30 mhz) 50* 3 * 2 : 30 mhz in sleep mode 75* 1 95* 1 * 3 : 15 mhz 40* 2 50* 2 20* 3 25* 3 in standby mode 15 30 m a ta = 25c (rtc on) 400 ta > 50c (rtc on) 5 15 ta = 25c (rtc off) 300 ta > 50c (rtc off) input reset, nmi vih v cc 0.9 v cc + 0.3v voltage breq, irl3Cirl0, v cc C 0.5 v cc + 0.3 standby mode md5Cmd0 v cc C 0.7 v cc + 0.3 normal operation extal, ckio v cc C 0.7 v cc + 0.3 other input pins 2.0 v cc + 0.3 reset, nmi vil C0.3 v cc 0.1 breq, irl3Cirl0, C0.3 0.5 standby mode md5Cmd0 C0.3 v cc 0.2 normal operation other input pins C0.3 v cc 0.2 input leak current all input pins |lin| 1.0 m av in = 0.5 to v cc C 0.5 v three- state leak current i/o, output, all pins (off condition) |lsti| 1.0 m av in = 0.5 to v cc C 0.5 v
427 table 16.2 dc characteristics (ta = C20 to 75c) (cont) item symbolmin type max unit remarks output voltage all output pins voh 2.4 v v cc = 3.0 v, ioh = C200 m a 2.0 v cc = 3.0 v, ioh = C2 ma vol 0.55 v cc = 3.6 v, iol = 1.6 ma pull-up resistance port pins rpull 30 60 120 k w terminal capaci- tance all pins c 20 pf notes: 1. regardless of whether pll or rtc is used, connect pllv cc , rtcv cc to v cc , and pllgnd, rtcgnd to gnd. 2. with vih min = v cc C 0.5 v, vil max = 0.5 v, and all output pins unloaded. table 16.3 permissible output current values (v cc = 3.3 0.3 v, ta = C20 to 75c) item symbol min typ max unit permissible output low current (per pin) iol 2.0 ma permissible output low current (total) s iol 120 permissible output high current (per pin) Cioh 2.0 permissible output high current (total) s (Cioh) 40 note: to ensure reliability, output current must not exceed the maximum values listed. 16.3 ac characteristics input for the sh7708 series should, as a rule, be clock synchronous. keep to the setup and hold times for each input signal unless otherwise directed. table 16.4 lsi clock values (ta = C20 to 75c) item symbol min typ max unit operating cpu, cache, tlb f 1 60 mhz frequency external bus 1 60 peripheral modules 0.25 30
428 16.3.1 clock timing table 16.5 clock timing (v cc = 3.3 0.3 v, ta = C20 to + 75c, maximum external bus operating frequency: 15 mhz) item symbol min max unit figure extal clock input frequency f ex 2 30 mhz 16.1 extal clock input cycle time t excyc 33.3 500 ns extal clock input low level pulse width t exl 8* 1 or 12* 2 ns extal clock input high level pulse width t exh 8* 1 or 12* 2 ns extal clock input rise time t exr 4ns extal clock input fall time t exf 4ns ckio clock frequency (input) f cki 8 15 mhz 16.2 ckio clock cycle time (input) t ckicyc 66.7 125 ns ckio clock low-level pulse width (input) t ckil 8ns ckio clock high-level pulse width (input) t ckih 8ns ckio clock rise time (input) t ckir 4ns ckio clock fall time (input) t ckif 4ns ckio clock output frequency (output) f op 1 15 mhz 16.3 ckio clock cycle time (output) t cyc 66.7 1000 ns ckio clock low-level pulse width (output) t ckol 20 ns ckio clock high-level pulse width (output) t ckoh 20 ns ckio clock rise time (output) t ckor 7ns ckio clock fall time (output) t ckof 7ns power-on oscillation settling time t osc1 10 ms 16.4 power-on oscillation settling time/mode setting t oscmd 10 ms breq reset hold time t breqrh 0ns reset set-up time t ress 20 ns breq set-up time t breqs 20 ns md reset hold time t mdrh 20 ns reset assert time t resw 20 tcyc 16.4, 16.5, 16.11 standby return oscillation settling time 1 t osc2 10 ms 16.5
429 table 16.5 clock timing (v cc = 3.3 0.3 v, ta = C20 to + 75c, maximum external bus operating frequency: 15 mhz) (cont) item symbol min max unit figure standby return oscillation settling time 2 t osc3 10 ms 16.6 standby return oscillation settling time 3 t osc4 11 ms 16.7 pll synchronization settling time t pll 100 m s 16.8, 16.9, 16.10 irl interrupt decision time (using rtc and in standby mode) t irlstb 100 m s 16.10 notes: 1. pll circuit 2 in operation. 2. pll circuit 2 not in operation.
430 table 16.6 clock timing (v cc = 3.3 0.3 v, ta = C20 to 75c, maximum external bus operating frequency: 30 mhz) item symbol min max unit figure extal clock input frequency f ex 2 30 mhz 16.1 extal clock input cycle time t excyc 33.3 500 ns extal clock input low level pulse width t exl 7* 1 or 10* 2 ns extal clock input high level pulse width t exh 7* 1 or 10* 2 ns extal clock input rise time t exr 4ns extal clock input fall time t exf 4ns ckio clock frequency (input) f cki 8 30 mhz 16.2 ckio clock cycle time (input) t ckicyc 33.3 125 ns ckio clock low-level pulse width (input) t ckil 7ns ckio clock high-level pulse width (input) t ckih 7ns ckio clock rise time (input) t ckir 3ns ckio clock fall time (input) t ckif 3ns ckio clock output frequency (output) f op 1 130 mhz 16.3 ckio clock cycle time (output) t cyc 33.3 1000 ns ckio clock low-level pulse width (output) t ckol 8ns ckio clock high-level pulse width (output) t ckoh 8ns ckio clock rise time (output) t ckor 6ns ckio clock fall time (output) t ckof 6ns power-on oscillation settling time t osc1 10 ms 16.4 power-on oscillation settling time/mode setting t oscmd 10 ms breq reset hold time t breqrh 0ns reset set-up time t ress 20 ns breq set-up time t breqs 20 ns md reset hold time t mdrh 20 ns reset assert time t resw 20 tcyc 16.4, 16.5, 16.11 standby return oscillation settling time 1 t osc2 10 ms 16.5 standby return oscillation settling time 2 t osc3 10 ms 16.6 standby return oscillation settling time 3 t osc4 11 ms 16.7
431 table 16.6 clock timing (v cc = 3.3 0.3 v, ta = C20 to 75c, maximum external bus operating frequency: 30 mhz) (cont) item symbol min max unit figure pll synchronization settling time t pll 100 m s 16.8, 16.9, 16.10 irl interrupt decision time (using rtc and in standby mode) t irlstb 100 m s 16.10 notes: 1. pll circuit 2 in operation. 2. pll circuit 1 not in operation.
432 table 16.7 clock timing (v cc = 3.3 0.3 v, ta = C20 to 75c, maximum external bus operating frequency: 60 mhz) item symbol min max unit figure extal clock input frequency f ex 2 60 mhz 16.1 extal clock input cycle time t excyc 16.7 500 ns extal clock input low-level pulse width t exl 4* 1 or 10* 2 ns extal clock input high-level pulse width t exh 4* 1 or 10* 2 ns extal clock input rise time t exr 2ns extal clock input fall time t exf 2ns ckio clock frequency (input) f cki 8 60 mhz 16.2 ckio clock cycle time (input) t ckicyc 16.7 125 ns ckio clock low-level pulse width (input) t ckil 4ns ckio clock high-level pulse width (input) t ckih 4ns ckio clock rise time (input) t ckir 2ns ckio clock fall time (input) t ckif 2ns ckio clock output frequency (output) f op 1 60 mhz 16.3 ckio clock cycle time (output) t cyc 16.7 1000 ns ckio clock low-level pulse width (output) t ckol 3ns ckio clock high-level pulse width (output) t ckoh 3ns ckio clock rise time (output) t ckor 5ns ckio clock fall time (output) t ckof 5ns power-on oscillation settling time t osc1 10 ms 16.4 power-on oscillation settling time/mode setting t oscmd 10 ms breq reset hold time t breqrh 0ns reset set-up time t ress 20 ns breq set-up time t breqs 20 ns md reset hold time t mdrh 20 ns reset assert time t resw 20 tcyc 16.4, 16.5, 16.11 standby return oscillation settling time 1 t osc2 10 ms 16.5 standby return oscillation settling time 2 t osc3 10 ms 16.6 standby return oscillation settling time 3 t osc4 11 ms 16.7
433 table 16.7 clock timing (v cc = 3.3 0.3 v, ta = C20 to 75c, maximum external bus operating frequency: 60 mhz) (cont) item symbol min max unit figure pll synchronization settling time t pll 100 m s 16.8, 16.9, 16.10 irl interrupt decision time (using rtc and in standby mode) t irlstb 100 m s 16.10 notes: 1. pll circuit 2 in operation. 2. ipll circuit 2 not in operation. t exh t exf t exr t exl t excyc v ih v ih v ih 1/2 v cc 1/2 v cc v il v il extal* (input) note: the clock input from the extal pin. figure 16.1 extal clock input timing t ckih t ckif t ckir t ckil tcki cyc v ih 1/2 v cc 1/2 v cc v ih v il v ih v il ckio (input) figure 16.2 ckio clock input timing
434 t cyc t ckol t ckoh v ih 1/2v cc ckio (output) 1/2v cc t ckor t ckof v oh v ol v ol v oh figure 16.3 ckio clock output timing v cc min t resw t ress t osc1 t breqrh t breqs t mdrh t oscmd v cc reset breq md0?d2 ckio, internal clock stable oscillation note: oscillation settling time when built-in oscillator is used figure 16.4 power-on oscillation settling time
435 ckio, internal clock stable oscillation standby t osc2 t resw res note: oscillation settling time when built-in oscillator is used figure 16.5 standby return oscillation settling time (return by reset) ckio, internal clock stable oscillation standby t osc3 nmi note: oscillation settling time when built-in oscillator is used figure 16.6 standby return oscillation settling time (return by nmi)
436 ckio, internal clock stable oscillation standby t osc4 irl3 irl0 note: oscillation settling time when built-in oscillator is used figure 16.7 standby return oscillation settling time (return by irl3 C irl0 ) extal input or ckio input stable input clock reset or nmi interrupt request stable input clock normal normal standby pll output, ckio output internal clock status 0 status 1 pll synchronization note: pll oscillation settlin g time when clock is input from extal pin or ckio pin t pll pll synchronization figure 16.8 pll synchronization settling time in case of reset or nmi interrupt
437 extal input or ckio input stable input clock irl (3e0) interrupt request stable input clock normal normal pll output, ckio output internal clock status 0 status 1 note: pll oscillation settlin g time when clock is input from extal pin or ckio pin t pll pll synchronization t irlstb standby pll synchronization figure 16.9 pll synchronization settling time in case of irl interrupt extal input or on-chip oscillator output ckoen ckio pll1 output internal clock note: pll oscillation settlin g time when output clock is controlled b y clock mode 0? t pll t pll pll synchronization pll synchronization pll synchronization figure 16.10 pll synchronization settling time in case of ckoen bit manipulation
438 16.3.2 control signal timing table 16.8 control signal timing (v cc = 3.3 0.3 v, ta = C20 to + 75c) C60* 2 item symbol min max unit figure reset pulse width t resw 20 tcyc 16.11, 16.13, reset setup time t ress 23 ns 16.15 reset hold time t resh 2ns breq setup time t breqs 12 ns breq hold time t breqh 3ns breq reset setup time t breqrs 17 ns breq reset hold time t breqrh 16 ns md reset setup time t mdrs 20 tcyc 16.12 md reset hold time t mdrh 16 ns nmi setup time* 1 t nmis 15 ns 16.13, 16.14 irl3 C irl0 setup time* 1 t irls 10 ns nmi hold time t nmih 4ns irl3 C irl0 hold time t irlh 4ns irqout delay time t irqod 12ns back delay time t backd 12 ns 16.15, 16.16 status1, status0 delay time t std 16ns bus tri-state delay time 1 t boff1 016ns bus tri-state delay time 2 t boff2 016ns bus buffer on time 1 t bon1 016ns bus buffer on time 2 t bon2 016ns notes: 1. reset , nmi, and irl3 to irl0 are asynchronous. changes are detected at the clock fall when the setup shown is used. when the setup cannot be used, detection can be delayed until the next clock fall. 2. upper limit of external bus clock is 60 mhz.
439 ckio reset breq t ress t ress t resw t breqrs t breqs t breqrh figure 16.11 manual reset input timing t mdrs t mdrh reset md0?d5 figure 16.12 mode input timing
440 ckio reset t resh t ress v ih v il nmi t nmih t nmis v ih v il irl3 irl0 t irlh t irls v ih v il figure 16.13 interrupt signal input timing ckio t irqod t irqod irqout figure 16.14 irqout timing
441 ckio breq back rd , rd/ wr , ras , cas , csn , wen , bs a25?0, d31?0 t backd t boff2 t boff1 t bon1 t backd t bon2 t breqh t breqh t breqs t breqs figure 16.15 bus release timing ckio t std t boff2 t boff1 t std t bon2 t bon1 normal mode standby mode normal mode status 0 status 1 rd , rd/ wr , ras , cas , csn , wen , bs a25?0, d31?0 figure 16.16 pin drive timing for standby mode
442 16.3.3 ac bus timing specifications table 16.9 bus timing (conditions: clock mode 0/1/2/7, v cc = 3.3 0.3 v, ta = C20 to 75c) C60* 1 item symbol min max unit figure address delay time t ad 13 ns 16.17C16.58 address setup time t as 0ns address hold time t ah 0ns bs delay time t bsd 12ns cs delay time 1 t csd1 12ns cs delay time 2 t csd2 12ns read write delay time t rwd 12ns read write setup time t rws 0ns read write hold time t rwh 0ns read strobe delay time t rsd 12ns read data setup time 1 t rds1 12 ns read data setup time 2 t rds2 8ns read data hold time 1 t rdh1 0ns read data hold time 2 t rdh2 3ns write enable delay time t wed 12ns write data delay time 1 t wdd1 15ns write data delay time 2 t wdd2 15ns write data setup time t wds 0ns write data hold time 1 t wdh1 0ns write data hold time 2 t wdh2 0ns write data hold time 3 t wdh3 0ns write data hold time 4 t wdh4 0ns wait setup time* 2 t wts 12 ns wait hold time* 2 t wth 4ns
443 table 16.9 bus timing (conditions: clock mode 0/1/2/7, v cc = 3.3 0.3 v, ta = C20 to 75c) (cont) C60* 1 item symbol min max unit figure ras delay time 1 t rasd1 13 ns 16.23C16.44 ras delay time 2 t rasd2 13 ns cas delay time 1 t casd1 13 ns cas delay time 2 t casd2 13 ns dqm delay time t dqmd 12 ns cke delay time t cked 12 ns ce delay time t ced 13 ns 16.45C16.51 oe , rfsh delay time t oed 13 ns iciord delay time t icrsd 12 ns 16.56C16.58 iciowr delay time t icwsd 12 ns iois16 setup time t io16s 12 ns iois16 hold time t io16h 4ns notes: 1. upper limit of external bus clock is 60 mhz. 2. wait is a synchronous signal. operation cannot be guaranteed if the setup and hold times shown here are not observed.
444 table 16.10 bus timing (conditions: clock mode 3/4/5/6, v cc = 3.3 0.3 v, ta = C20 to 75c) item symbol min max unit figure address delay time t ad 20 ns 16.17C16.58 address setup time t as 0ns address hold time t ah 20 ns bs delay time t bsd 19ns cs delay time 1 t csd1 19ns cs delay time 2 t csd2 20ns read write delay time t rwd 19ns read write setup time t rws 0ns read write hold time t rwh 0ns read strobe delay time t rsd 20ns read data setup time 1 t rds1 12 ns read data setup time 2 t rds2 12 ns read data hold time 1 t rdh1 0ns read data hold time 2 t rdh2 8ns write enable delay time t wed 20ns write data delay time 1 t wdd1 25ns write data delay time 2 t wdd2 19ns write data setup time t wds 0ns write data hold time 1 t wdh1 0ns write data hold time 2 t wdh2 0ns write data hold time 3 t wdh3 0ns wait setup time t wts 12 ns wait hold time t wth 8ns
445 table 16.10 bus timing (conditions: clock mode 3/4/5/6, v cc = 3.3 0.3 v, ta = C20 to 75c) (cont) item symbol min max unit figure ras delay time 1 t rasd1 20 ns 16.23C16.44 ras delay time 2 t rasd2 19ns cas delay time 1 t casd1 20ns cas delay time 2 t casd2 19ns dqm delay time t dqmd 19ns cke delay time t cked 19ns ce delay time t ced 20 ns 16.45C16.51 oe , rfsh delay time t oed 20ns iciord delay time t icrsd 20 ns 16.56C16.58 iciowr delay time t icwsd 20ns iois16 setup time t io16s 12 ns iois16 hold time t io16h 8ns
446 16.3.4 basic timing t 1 ckio a25?0 csn rd/ wr rd (read) d31?0 (read) wen (write) d31?0 (write) bs t 2 t ad t ah t ad t csd1 t rwd t rsd t csd2 t wed t wdd1 t rds1 t bsd t bsd t rdh1 t rdh1 t wed t rsd t ah t rwh t rwd t wdh1 t rwh t rwh t ah t wdh3 figure 16.17 basic bus cycle (no wait)
447 t 1 t w t 2 ckio a25?0 csn rd/ wr rd (read) d31?0 (read) wen (write) d31?0 (write) bs wait t ad t ad t rwd t rwh t ah t ah t rsd1 t csd1 t wed1 t wdd1 t bsd t wts t wth t bsd t rds1 t csd2 t wed t rsd t rdh1 t rdh1 t rwd t ah t rwh t wdh3 t wdh1 t rwh figure 16.18 basic bus cycle (1 wait)
448 t 1 t w t w t 2 ckio a25?0 csn rd/ wr rd (read) d31?0 (read) wen (write) d31?0 (write) bs wait t ad t ad t rwd t rsd t wed t wdd1 t wts t wth t bsd t bsd t rds1 t wts t wth t csd1 t csd2 t rsd t wed t rdh1 t ah t rwh t rdh1 t ah t rwh t rwd t rwh t ah t wdh3 t wdh1 figure 16.19 basic bus cycle (external wait)
449 16.3.5 burst rom timing ckio a25?4 a3?0 csn rd/ we rd d31?0 bs wait t ad t ad t ad t ad t csd1 t rwd t bsd t bsd t ah t bsd t bsd t csd2 t rsd t rds1 t wts t wth t rds t rsd t 1 t b2 t b1 t b2 t b1 t b2 t b1 t 2 t rsd t rdh1 t rsd t ah t rdh1 t rwh t ah t rwh t rwd t rdh1 note: in the write cycle, the basic bus cycle is performed. figure 16.20 burst rom bus cycle (no wait)
450 ckio a25ea4 a3ea0 csn rd/ we rd d31?0 bs wait t ad t ad t ad t csd1 t rwh t rwd t rsd t rsd t rdh1 t rdh1 t rdh1 t rds1 t bsd t bsd t bsd t bsd t wts t wth t wts t wth t wts t wth t wts t wth t 1 t w t w t b2 t b1 t b2 t w t 2 t 2 t csd2 t rds1 t rsd t rsd t ah t ah t rdh1 t ah t rsd t rwd t rwh note: in the write cycle, the basic bus cycle is performed. figure 16.21 burst rom bus cycle (2 waits)
451 ckio a25?4 a3?0 csn rd/ we rd d31 to d0 bs wait t 1 t w t w t b2 t b1 t 2 t bw t ad t ad t csd1 t csd2 t rwd t rwh t rdh1 t ah t ah t rwd t rsd t rsd1 t ah t ad t bsd t bsd t wts t wth t wts t wth t wts t wth t wts t wth t bsd t bsd t rds1 t rdh1 t rsd t rdh1 t rwh t rsd1 note: in the write cycle, the basic bus cycle is performed. t rds figure 16.22 burst rom bus cycle (external wait input)
452 16.3.6 dram timing t ad t ad t bsd t csd1 t csd1 t bsd t rds1 t r t c1 t c2 (t pc ) ckio a25 to a16 a15 to a0 rd/ wr ras casxx d31?0 (read) d31?0 (write) cs2 or cs3 bs row address t ad t rwd t ah t ad t as t as row address column address t rasd1 t casd1 t wds t rasd1 t rwh t ah t rwh t ah t casd1 t rdh1 t wdd2 t rwd t wdh3 t wdh1
453 figure 16.23 dram bus cycle (rcd = 0, anw = 1, tpc = 0) t wdh1 t wdh3 t bsd t csd1 t csd1 t bsd t rds1 t r t rw t rw t c1 t cw t c2 (t pc )(t pc ) ckio a25 to a16 a15 to a0 rd/ wr ras casxx d31?0 (read) d31?0 (write) cs2 or cs3 bs t ad t ad t ad t as t ad t as row address row address column address t rasd1 t rasd1 t rwh t ah t rwh t ah t casd1 t casd1 t wds t rwd t ah t rdh1 t wdd2 t rwd figure 16.24 dram bus cycle (rcd = 2, anw = 2, tpc = 1)
454 t r ckio a25?16 a15?0 rd/ wr ras casxx d31?0 (read) d31?0 (write) cs2 or cs3 bs t c1 t c2 t c1 t c2 t c1 t c2 t c1 t c2 (t pc ) t ad row address t ad column address column address column address column address t bsd t bsd t wdh3 t wdh3 t csd1 t csd1 t rasd1 t rwh t ah t rasd1 t casd1 t casd1 t casd1 t ah t rds1 t wds t rdh1 t casd1 t rwd t ah t ad t ad t ad t as t as row address t rwd t rds1 t rdh1 t wdd2 t rwh t wdd2 t wdh1 figure 16.25 dram burst bus cycle (rcd = 0, anw = 1, tpc = 0)
455 ckio rd/ wr d31?0 (read) d31?0 (write) ras casxx bs cs2 or cs3 a25?16 a15?0 t r t ad row address t ad t rwd t rwh t rdh1 t rdh1 t rds1 t wds t ah t ah t rwh t wdh3 t wdh1 t wdh3 t wdd2 t csd1 t bsd t bsd t csd1 t as t as t ad t c2 (t pc ) t rasd1 t cw t c1 t c2 t cw t c1 t rw t rw t ah t rwd t rasd1 t casd1 t rds1 t ad t ad row address t casd1 t casd1 t wdd2 column address column address row address figure 16.26 dram burst bus cycle (rcd = 2, anw = 2, tpc = 0)
456 ckio rd/ wr d31?0 (read) d31?0 (write) ras casxx bs cs2 or cs3 a25?16 t r t c1 t c2 (t pc ) t ad t ad t as t ad t rasd1 t ad t as t ah t rwd t ah a15?0 t rwh t rwd t rasd2 t casd1 t casd1 t wdh3 t wdh1 t rdh2 t rds2 t wdd2 t bsd t bsd t csd1 t csd1 t wds row address row address column address figure 16.27 dram bus cycle (edo mode, rcd = 0, anw = 1, tpc = 0)
457 ckio rd/ wr d31?0 (read) d31?0 (write) ras casxx bs cs2 or cs3 a25?16 a15?0 t r t rw t rw t c1 t cw t c2 (t pc ) (t pc ) t rwh t rwd row address t ad t ad t rwd t rasd1 t ah t ad t as t ad t ah t as t rasd2 t casd1 t wdh3 t wdh1 t wds t rds2 t rdh2 t casd1 t bsd t bsd t csd1 t csd1 row address column address t wdd2 figure 16.28 dram bus cycle (edo mode, rcd = 2, anw = 2, tpc = 1)
458 ckio rd/ wr d31?0 (read) d31?0 (write) ras casxx bs cs2 or cs3 a25?16 a15?0 t r t ad row address column address column address t ad t ad t rwd t wdh3 t rds2 t rds2 t wds t rdh2 t wdh3 t csd1 t bsd t bsd t csd1 t as t as t ah t ah t ah t rwh t ad t ad t c2 (t pc ) t wdh1 t wdd2 t c1 t c2 t c1 t c2 t c1 t c2 t c1 t rwd t rasd1 t casd1 t casd1 t casd1 t casd1 row address t rasd2 t rdh2 t wdd2 column address column address row address figure 16.29 dram burst bus cycle (edo mode, rcd = 0, anw = 1, tpc = 0)
459 ckio rd/ wr d31?0 (read) d31?0 (write) ras casxx bs cs2 or cs3 a25?16 a15?0 t r row address row address t c2 (t pc ) t cw t c1 t c2 t cw t c1 t rw t rw t ad t ad t ah t ah t rdh2 t wdh3 t wdd2 t wdh1 t wdh3 t rds2 t rwh t rwd t ah t ad t as t ad t ad t as t rwd t rasd1 t rasd2 t rdh2 t rds2 t casd1 t casd1 t wdd2 t wds t bsd t csd1 t csd1 t bsd t casd1 column address column address figure 16.30 dram burst bus cycle (edo mode, rcd = 2, anw = 2, tpc = 0)
460 t rc t rr1 t rrw t rr2 t rasd1 t rasd1 t casd1 t casd1 t rwd (high) (t pc ) ckio rd/ wr ras casxx cs2 or cs3 figure 16.31 dram cas-before-ras refresh cycle (tras = 0, tpc = 0) t rc t rr1 t rrw t rrw t rrw t rrw t rr2 t rasd1 t rasd1 t casd1 t casd1 t rwd (high) (t pc )(t pc )(t pc ) ckio rd/ wr ras casxx cs2 or cs3 figure 16.32 dram cas-before-ras refresh cycle (tras = 3, tpc = 2)
461 t rc t rr1 t rrw t sr1 t sr1 t sr2 (t pc ) t rasd1 t rasd1 t casd1 t casd1 t rwd (high) (t pc ) ckio rd/ wr ras casxx cs2 or cs3 figure 16.33 dram self-refresh cycle (tpc = 0)
462 16.3.7 synchronous dram timing t r t c1 t c2 (t pc ) ckio a25?16 a12 or a10 a15?0 rd/ wr ras cas dqmxx d31?0 bs cke t csd1 t csd1 t rasd2 t rasd2 t casd2 t casd2 t dqmd t dqmd t bsd t bsd (high) t rdh2 t rds2 csn t ad t ad row address t ad t ad t ad t ad row address row address column address t ad t ad read a command t rwd t rwd figure 16.34 synchronous dram read bus cycle (rcd = 0, cas latency = 1, tpc = 0)
463 ckio a25?16 a12 or a10 a15?0 rd/ wr ras cas dqmxx d31?0 bs cke t csd1 t csd1 t rasd2 t rasd2 t casd2 t casd2 t dqmd t dqmd t bsd t bsd (high) t rdh2 t rds2 csn t ad t ad t ad t ad t ad t ad t ad t ad t rwd t rwd t r t rw t rw t c1 t cw t d1 (t pc )(t pc ) column address row address row address row address read a command figure 16.35 synchronous dram read bus cycle (rcd = 2, cas latency = 2, tpc = 1)
464 ckio a25?16 a12 or a10 a15?0 rd/ wr ras cas dqmxx d31?0 bs cke csn t r t c1 t c2 /t d1 t c3 /t d2 t c4 /t d3 t d4 (t pc )(t pc ) t ad t ad t ad t ad t ad t ad row address read a command t ad t ad t ad column address (1e4) read command row address row address t csd1 t csd1 t rwd t rwd t casd2 t casd2 t dqmd t dqmd t bsd t bsd t rdh2 t rds2 t rdh2 t rds2 t rasd2 t rasd2 (high) figure 16.36 synchronous dram read bus cycle (burst read (single read 4), rcd = 0, cas latency = 1, tpc = 1)
465 t r t rw t c1 t c2 t c3 t c4 /t d1 t d2 t d3 t d4 (t pc ) ckio a25?16 a12 or a10 a15?0 rd/ wr ras cas dqmxx d31?0 bs cke csn (high) t ad t ad t ad t ad t ad row address row address row address t ad t ad t ad t ad t ad t rwd t rwd read command t csd1 t csd1 t casd2 t casd2 t dqmd t dqmd t bsd t bsd t rdh2 t rds2 t rdh2 t rds2 t rasd2 t rasd2 column address (1?) figure 16.37 synchronous dram read bus cycle (burst read (single read 4), rcd = 1, cas latency = 3, tpc = 0)
466 t r t c1 (t rwl ) (tpc) ckio a25?16 a12 or a10 a15?0 rd/ wr ras cas dqmxx d31?0 bs cke t csd1 t csd1 t rasd2 t rasd2 t casd2 t casd2 t dqmd t dqmd t bsd t bsd (high) t wdh2 t wdd2 csn t ad t ad row address t ad t ad t ad t ad row address row address t ad t ad write a command t rwd t rwd t rwd column address figure 16.38 synchronous dram write bus cycle (rcd = 0, tpc = 0, trwl = 0)
467 ckio a25?16 a12 or a10 a15?0 rd/ wr ras cas dqmxx d3?0 bs cke csn t r t rw t rw t c1 (t rwl )(t rwl )(t pc ) (t pc ) t csd1 t csd1 t rasd2 t rasd2 t casd2 t casd2 t dqmd t dqmd t bsd t bsd (high) t wdh2 t wdd2 t ad t ad row address t ad t ad t ad t ad row address t ad t ad t ad t rwd t rwd t rwd t ad row address write a command column address figure 16.39 synchronous dram write bus cycle (rcd = 2, tpc = 1, trwl = 1)
468 ckio a25?16 a12 or a10 a15?0 rd/ wr ras cas dqmxx d31?0 bs cke csn t r t c1 t c2 t c3 t c4 (t rwl )(t pc )(t pc ) t ad t ad t ad t ad t ad t ad write command row address write a command t ad t ad t ad column address (1?) row address t csd1 t csd1 t casd2 t casd2 t dqmd t dqmd t bsd t bsd t wdh2 t wdd2 t wdd2 t rasd2 t rasd2 t rwd t rwd t rwd row address (high) figure 16.40 synchronous dram write bus cycle (burst mode (single write 4), rcd = 0, tpc = 1, trwl = 0)
469 t r t rw t c1 t c2 t c3 t c4 (t rwl ) (t pc ) ckio a25?16 a12 or a10 a15?0 rd/ wr ras cas dqmxx d31?0 bs cke csn (high) t ad t ad t ad t ad row address row address row address t ad t ad t ad t ad t rwd t rwd t rwd write command t ad t csd1 t csd1 t casd2 t casd2 t dqmd t dqmd t bsd t bsd t wdd2 t wdd2 t rasd2 t rasd2 column address (1e4) write a command t wdh2 figure 16.41 synchronous dram write bus cycle (burst mode (single write 4), rcd = 1, tpc = 0, trwl = 0)
470 ckio cke t rr t rrw t rrw (t pc ) (t pc ) (high) t csd1 t csd1 t rasd2 t rasd2 t casd2 t casd2 t rwd rd/ wr ras cas csn figure 16.42 synchronous dram auto-refresh cycle (tras = 1, tpc = 1)
471 ckio cke t rs1 (t rs2 ) (t rs2 ) t rs3 (t pc ) (t pc ) t csd1 t csd1 t cked t cked t rasd2 t rasd2 t casd2 t casd2 t rwd t rwd rd/ wr ras cas csn figure 16.43 synchronous dram self-refresh cycle (tpc = 0)
472 ckio a13 or a11 a12 or a10 a11?2 or a9?2 rd/ wr (high) ras casxx d31?0 cke csn t rp1 t rp2 t rp3 t rp4 t mw1 t mw2 t mw3 t mw4 t ad t ad t ad t ad t ad t ad t csd1 t ad t ad t ad t ad t ad t rasd2 t rasd2 t rasd2 t rasd2 t csd1 t rwd t rwd t rwd t casd2 t casd2 figure 16.44 synchronous dram mode register write cycle
473 16.3.8 pseudo-sram timing t ad t as t ad t wdh3 t bsd t bsd t oed t wed t wds t rds1 a25?0 rd/ wr ce oe / rfsh (read) d31?0 (read) wen (write) d31?0 (write) bs t rwd t r t c1 t c2 (t pc ) ckio t rws t ced t rdh1 t rwd t rwh t ced t ah t oed t rwh t ah t wed t rwh t ah t wdd2 t wdh1 figure 16.45 pseudo-sram bus cycle (rcd = 0, a3w = 1, tpc = 0)
474 t ad t as t ad t wds t wdh3 t bsd t bsd t oed t rds1 a25?0 rd/ wr ce oe / rfsh (read) wen (write) d31?0 (read) d31?0 (write) bs ckio t r t rw t c1 t c1w t c1w t c2 (t pc ) t rdh1 t wed t wed t rwh t ah t rwd t rws t rwd t ced t oed t ah t ced t ah t rwh t rwh t wdd2 t wdh1 figure 16.46 pseudo-sram read cycle (rcd = 1, a3w = 3, tpc = 0)
475 ckio a25?4 rd/ wr oe / rfsh (read) ce wen (write) d31?0 (read) d31?0 (write) bs t ad t as t r t c1 t c2 t c1 t c2 t c1 t c2 t c1 t c2 (t pc ) t ad t bsd t bsd t bsd t bsd t ced t ced t ah t oed t oed t oed t ah t wed t as t as t wed t wds t wdh3 t wdh3 t rds1 t rds1 t rwd t rws t rwd t wed t wed t oed t ah t wdd2 t wdd2 t wdh1 a3?0 t ad t rwh t rwh t rdh1 t rwh t rdh1 figure 16.47 pseudo-sram bus cycle (static column mode, rcd = 0, a3w = 1, tpc = 0)
476 ckio a25?4 rd/ wr oe / rfsh (read) ce wen (write) d31?0 (read) d31?0 (write) bs t r t rw t c1 t c1w t c2 t c1 t c1w t c2 (t pc )(t pc ) t bsd t bsd t bsd t bsd t ad t as a3?0 t ad t rwd t rws t rds1 t oed t oed t oed t wed t wed t wds t wdh3 t wdh3 t wed t rdh1 t rds1 t ced t rwh t ah t rwh t rwh t ah t ah t oed t wed t ced t rwd t ad t as t wdd2 t wdd2 t wdh1 t rdh1 figure 16.48 pseudo-sram bus cycle (static column mode, rcd = 1, a3w = 2, tpc = 1)
477 ckio (high) oe / rfsh ce t rc t rr1 t rr2 (t pc ) t oed t oed figure 16.49 pseudo-sram auto-refresh cycle (tras = 1, tpc = 1) ckio oe / rfsh ce t rc t rr1 t rrw t rrw t rr2 (t pc )(t pc ) t oed t oed (high) figure 16.50 pseudo-sram auto-refresh cycle (tras = 2, tpc = 1) ckio (high) oe / rfsh ce t rc t rr1 t sr t sr2 (t pc )(t pc ) t oed t oed figure 16.51 pseudo-sram self-refresh cycle (tpc = 0)
478 16.3.9 pcmcia timing t pcm1 t pcm2 ckio a25?0 cexx rd/ wr rd (read) d15?0 (read) we1 (write) d15?0 (write) bs t ad t ad t csd1 t csd1 t rwd t rsd t rsd t rwd t wed t wdd1 t wed t rds1 t rdh1 t bsd t bsd t wdh4 t wdh1 figure 16.52 pcmcia memory bus cycle (ted = 0, teh = 0, no wait)
479 ckio t pcm0 t pcm0w t pcm1 t pcm1w t pcm1w t pcm2 t pcm2w a25?0 cexx rd/ wr rd (read) d15?0 (read) we1 (write) d15?0 (write) bs wait t ad t csd1 t rwd t ad t csd1 t rwd t wdh4 t rsd t rsd t wed t wdd1 t wed1 t wdh1 t rdh1 t bsd t wts t wth t wts t wth t rds1 t bsd figure 16.53 pcmcia memory bus cycle (ted = 2, teh = 1, 1 wait, external wait)
480 ckio t pcm1 t pcm2 t pcm1 t pcm2 t pcm1 t pcm2 t pcm1 t pcm2 a25?4 a3?0 cexx rd/ wr rd (read) d15?0 (read) bs t ad t ad t csd1 t rwd t csd1 t rwd t ad t ad t ad t ad t rsd t rsd t rdh1 t rdh1 t rsd t rsd t bsd t bsd t bsd t bsd t rds1 t rds1 note: even though burst mode is set, write cycle operation is the same as in normal mode. figure 16.54 pcmcia memory bus cycle (burst read, ted = 0, teh = 0, no wait)
481 ckio t pcm0 t pcm1 t pcm1w t pcm1w t pcm1w t pcm2 t pcm1 t pcm1w t pcm2 t pcm2w a25?4 a3?0 cexx rd/ wr rd (read) d15?0 (read) bs wait t ad t ad t csd1 t rwd t csd1 t rwd t ad t ad t ad t rsd t rsd t rsd t rsd t bsd t bsd t bsd t bsd t rds1 t rdh1 t rdh1 t rds1 t wts t wth t wts t wts t wth t wth note: even though burst mode is set, the write cycle operation is the same as in normal mode. figure 16.55 pcmcia memory bus cycle (burst read, ted = 1, teh = 1, 2 waits, burst pitch = 3)
482 t pci1 t pci2 ckio a25?0 cexx rd/ wr iciord (read) d15?0 (read) iciowr (write) d15?0 (write) bs t ad t ad t csd1 t csd1 t rwd t icrsd t icrsd t rwd t icwsd t wdd1 t icwsd t rdh1 t rds1 t bsd t bsd t wdh1 t wdh4 figure 16.56 pcmcia i/o bus cycle (ted = 0, teh = 0, no wait)
483 ckio t pci0 t pci0w t pci1 t pci1w t pci1w t pci2 t pci2w a25?0 cexx rd/ wr iciord (read) d15?0 (read) iciowr (write) d15?0 (write) bs wait iois16 t ad t csd1 t rwd t ad t csd1 t rwd t icrsd t icrsd t icwsd t wdd1 t icwsd t wdh1 t wdh4 t rdh1 t bsd t bsd t wts t wth t wts t wth t io16s t io16h t rds1 figure 16.57 pcmcia i/o bus cycle (ted = 2, teh = 1, 1 wait, external wait)
484 ckio t pci0 t pci1 t pci1w t pci2 t pci1 t pci1w t pci2 t pci2w a25?4 a0 cexx rd/ wr iciord (read) d15?0 (read) iciowr (write) d15?0 (write) bs wait iois16 t ad t ad t csd1 t csd1 t rwd t rwd t wdd1 t wdh3 t wdh4 t bsd t bsd t ad t ad t icrsd t icrsd t icrsd t icrsd t icwsd t wts t wth t wth t io16s t io16h t ad t rds1 t csd1 t rds1 t icwsd t icwsd t icwsd t rdh1 t rdh1 t wdd2 t wdh1 t bsd t bsd t wts figure 16.58 pcmcia i/o bus cycle (ted = 1, teh = 1, 1 wait, bus sizing)
485 16.3.10 peripheral module signal timing table 16.11 peripheral module signal timing (conditions: v cc = 3.3 0.3 v, ta = 0 to 75c) C15 C30 C60 module item symbol min max min max min max unit figure tmu, timer input setup time t clks1 20 15 12 ns 16.54, rtc timer clock input setup time t cks 20 15 12 ns 16.55 timer clock;single edge t tckwh 1.5 1.5 1.5 tcyc pulse width; both edges t tckwl 2.5 2.5 2.5 tcyc oscillation settling time t rosc 3 3 3 s 16.61 sci input clock cycle; asynchronous t scyc 4 4 4 tcyc 16.62C 16.64 synchronous 6 6 6 tcyc input clock rise time t sckr 1.5 1.5 1.5 tcyc input clock fall time t sckf 1.5 1.5 1.5 tcyc input clock pulse width t sckw 0.4 0.6 0.4 0.6 0.4 0.6 tscy c transmit data delay time t txd 100 100 100 ns receive data setup time (synchronous) t rxs 100 100 100 ns receive; clock input t rxh 100 100 100 ns data hold time (syn- chronous); clock output t rxh 000ns port output data delay time t portd 20 17 15 ns input data setup time t ports 20 15 12 ns input data hold time t porth 10 8 5 ns
486 t tclks ckio tclk (input) figure 16.59 tclk input timing (1) t tcks t tcks t tckwh t tckwl ckio tclk (input) figure 16.60 tclk input timing (2) rtc crystal oscillator stable oscillation v cc v ccmin t rosc figure 16.61 rtc crystal oscillator power-on oscillation settling time t sckw t sckr t sckf t scyc sck figure 16.62 sck input clock timing
487 t scyc t txd sck txd (data trans- mission) rxd (data reception) t rxh t rxs figure 16.63 synchronous mode sci input/output timing t ports f port 7 port 0 (read) port 7 port 0 (write) t porth t portd figure 16.64 i/o port input/output timing 16.3.11 ac characteristics test conditions input/output signal reference level: 1.5 v (v cc = 3.3 0.3 v). input pulse level: v ss to 3.0 v (when reset , breq , nmi, irl3 C irl0 , ckio, md5C md0 are v ss to v cc ). input rise/fall time: 1 ns
488 i ol i oh c l v ref lsi output pin dut output notes: 1. 2. c l is the total capacitance including the test jig probe, as shown below: 30 pf: ckio, ras , casxx , cso cs6 , ce2a , ce2b , back 50 pf: all other pins i ol and i oh are the values shown in table 17.3 figure 16.65 output load circuit
489 section 17 electrical characteristics (-sh7708r-) 17.1 absolute maximum ratings table 17.1 absolute maximum ratings item symbol ratings units power supply voltage v cc C0.3 to 4.6 v input voltage v in C0.3 to v cc + 0.3 v operating temperature t opr C20 to 75 c storage temperature t str C55 to 125 c note: operating the sh7708 series above maximum ratings can damage or destroy it.
490 17.2 dc characteristics table 17.2 dc characteristics (ta = C20 to 75c) item symbolmin typ max unitremarks power supply voltage v cc 3.15 3.3 3.6 v in normal operation, sleep mode, and standby mode current normal operation i cc 120* 1 200 * 1 ma v cc = 3.3 v *1 i? = 100 mhz b? = 50 mhz in sleep mode 75* 2 100 * 2 *2 b? = 60 mhz p? = 30 mhz in standby mode 0.1* 3 1* 3 ma *3 v cc = 3.3 v/ ta= 30 c input reset, nmi vih v cc 0.9 v cc + 0.3 v voltage breq, irl3Cirl0, v cc C 0.5 v cc + 0.3 standby mode md5Cmd0 v cc C 0.7 v cc + 0.3 normal operation extal, ckio v cc C 0.7 v cc + 0.3 other input pins 2.0 v cc + 0.3 reset, nmi vil C0.3 v cc 0.1 breq, irl3Cirl0, C0.3 0.5 standby mode md5Cmd0 C0.3 v cc 0.2 normal operation other input pins C0.3 v cc 0.2 input leak current all input pins |lin| 1.0 m av in = 0.5 to v cc C 0.5 v three- state leak current i/o, output, all pins (off condition) |lsti| 1.0 m av in = 0.5 to v cc C 0.5 v
491 table 17.2 dc characteristics (ta = C20 to 75 c) (cont) item symbolmin typ max unit remarks output voltage all output pins voh 2.4 v v cc = 3.15 v, ioh = C200 m a 2.0 v cc = 3.15 v, ioh = C2 ma vol 0.55 v cc = 3.6 v, iol = 1.6 ma pull-up resistance port pins rpull 30 60 120 k w terminal capaci- tance all pins c 20 pf notes: 1. regardless of whether pll or rtc is used, connect v cc (pll), v cc (rtc) to v cc , and v ss (pll), v ss (rtc) to v ss . 2. current condition is vih min = v cc C 0.5 v, vil max = 0.5 v, and all output pins unloaded. table 17.3 permissible output current values (v cc = 3.3 0.3 v, ta = C20 to 75c) item symbol min typ max unit permissible output low current (per pin) iol 2.0 ma permissible output low current (total) s iol 120 permissible output high current (per pin) Cioh 2.0 permissible output high current (total) s (Cioh) 40 note: to ensure reliability, output current must not exceed the maximum values listed. 17.3 ac characteristics input for the lsi should, as a rule, be clock synchronous. keep to the setup and hold times for each input signal unless otherwise directed. table 17.4 lsi clock values (ta = C20 to 75c) item symbol unit operating cpu, cache, tlb f 100 mhz frequency external bus 60 peripheral modules 33.3
492 17.3.1 clock timing table 17.5 clock timing (v cc = 3.15?C3.6 v, ta = C20 to 75 c, maximum external bus operating frequency: 60 mhz) item symbol min max unit figure extal clock input frequency f ex 5 60 mhz 17.1 extal clock input cycle time t excyc 16.7 200 ns extal clock input low-level pulse width t exl 4* 1 or 10* 2 ns extal clock input high-level pulse width t exh 4* 1 or 10* 2 ns extal clock input rise time t exr 2ns extal clock input fall time t exf 2ns ckio clock frequency (input) f cki 16 60 mhz 17.2 ckio clock cycle time (input) t ckicyc 16.7 62.5 ns ckio clock low-level pulse width (input) t ckil 4ns ckio clock high-level pulse width (input) t ckih 4ns ckio clock rise time (input) t ckir 2ns ckio clock fall time (input) t ckif 2ns ckio clock output frequency (output) f op 16 60 mhz 17.3 ckio clock cycle time (output) t cyc 16.7 62.5 ns ckio clock low-level pulse width (output) t ckol 3ns ckio clock high-level pulse width (output) t ckoh 3ns ckio clock rise time (output) t ckor 5ns ckio clock fall time (output) t ckof 5ns power-on oscillation settling time t osc1 10 ms 17.4 power-on oscillation settling time/mode setting t oscmd 10 ms breq reset hold time t breqrh 0ns reset set-up time t ress 20 ns breq set-up time t breqs 20 ns md reset hold time t mdrh 20 ns reset assert time t resw 20 tcyc 17.4, 17.5, 17.11 standby return oscillation settling time 1 t osc2 10 ms 17.5 standby return oscillation settling time 2 t osc3 10 ms 17.6 standby return oscillation settling time 3 t osc4 11 ms 17.7 pll synchronization settling time t pll 100 m s 17.8, 17.9, 17.10 irl interrupt decision time (using rtc and in standby mode) t irlstb 100 m s 17.10 notes: 1. pll circuit 2 in operation.
493 2. ipll circuit 2 not in operation. t exh t exf t exr t exl t excyc v ih v ih v ih 1/2 v cc 1/2 v cc v il v il extal* (input) note: the clock input from the extal pin. figure 17.1 extal clock input timing t ckih t ckif t ckir t ckil tcki cyc v ih 1/2 v cc 1/2 v cc v ih v il v ih v il ckio (input) figure 17.2 ckio clock input timing t cyc t ckol t ckoh v ih 1/2v cc ckio (output) 1/2v cc t ckor t ckof v oh v ol v ol v oh figure 17.3 ckio clock output timing
494 v cc min t resw t ress t osc1 t breqrh t breqs t mdrh t oscmd v cc reset breq md0?d2 ckio, internal clock stable oscillation note: oscillation settling time when built-in oscillator is used figure 17.4 power-on oscillation settling time ckio, internal clock stable oscillation standby t osc2 t resw res note: oscillation settling time when built-in oscillator is used figure 17.5 standby return oscillation settling time (return by reset)
495 ckio, internal clock stable oscillation standby t osc3 nmi note: oscillation settling time when built-in oscillator is used figure 17.6 standby return oscillation settling time (return by nmi) ckio, internal clock stable oscillation standby t osc4 irl3 irl0 note: oscillation settling time when built-in oscillator is used figure 17.7 standby return oscillation settling time (return by irl3 C irl0 )
496 extal input or ckio input stable input clock reset or nmi interrupt request stable input clock normal normal standby pll output, ckio output internal clock status 0 status 1 pll synchronization note: pll oscillation settlin g time when clock is input from extal pin or ckio pin t pll pll synchronization figure 17.8 pll synchronization settling time in case of reset or nmi interrupt extal input or ckio input stable input clock irl (3e0) interrupt request stable input clock normal normal pll output, ckio output internal clock status 0 status 1 note: pll oscillation settlin g time when clock is input from extal pin or ckio pin t pll pll synchronization t irlstb standby pll synchronization figure 17.9 pll synchronization settling time in case of irl interrupt
497 extal input or on-chip oscillator output ckoen ckio pll1 output internal clock note: pll oscillation settlin g time when output clock is controlled b y clock mode 0? t pll t pll pll synchronization pll synchronization pll synchronization figure 17.10 pll synchronization settling time in case of ckoen bit manipulation
498 17.3.2 control signal timing table 17.6 control signal timing (v cc = 3.15C3.6 v, ta = C20 to + 75 c) C60* 2 item symbol min max unit figure reset pulse width t resw 20 tcyc 17.11, 17.13, reset setup time t ress 23 ns 17.15 reset hold time t resh 2ns breq setup time t breqs 12 ns breq hold time t breqh 3ns breq reset setup time t breqrs 17 ns breq reset hold time t breqrh 16 ns md reset setup time t mdrs 20 tcyc 17.12 md reset hold time t mdrh 16 ns nmi setup time* 1 t nmis 15 ns 17.13, 17.14 irl3 C irl0 setup time* 1 t irls 10 ns nmi hold time t nmih 4ns irl3 C irl0 hold time t irlh 4ns irqout delay time t irqod 12ns back delay time t backd 12 ns 17.15, 17.16 status1, status0 delay time t std 16ns bus tri-state delay time 1 t boff1 016ns bus tri-state delay time 2 t boff2 016ns bus buffer on time 1 t bon1 016ns bus buffer on time 2 t bon2 016ns notes: 1. reset , nmi, and irl3 to irl0 are asynchronous. changes are detected at the clock fall when the setup shown is used. when the setup cannot be used, detection can be delayed until the next clock fall. 2. upper limit of external bus clock is 60 mhz.
499 ckio reset breq t ress t ress t resw t breqrs t breqs t breqrh figure 17.11 manual reset input timing t mdrs t mdrh reset md0?d5 figure 17.12 mode input timing
500 ckio reset t resh t ress v ih v il nmi t nmih t nmis v ih v il irl3 irl0 t irlh t irls v ih v il figure 17.13 interrupt signal input timing ckio t irqod t irqod irqout figure 17.14 irqout timing
501 ckio breq back rd , rd/ wr , ras , cas , csn , wen , bs a25?0, d31?0 t backd t boff2 t boff1 t bon1 t backd t bon2 t breqh t breqh t breqs t breqs figure 17.15 bus release timing
502 ckio t std t boff2 t boff1 t std t bon2 t bon1 normal mode standby mode normal mode status 0 status 1 rd , rd/ wr , ras , cas , csn , wen , bs a25?0, d31?0 figure 17.16 pin drive timing for standby mode
503 17.3.3 ac bus timing specifications table 17.7 bus timing (conditions: clock mode 0/1/2/7, v cc = 3.15C3.6 v, ta = C20 to 75 c) C60* 1 item symbol min max unit figure address delay time t ad 1.5 13 ns 17.17C17.58 address setup time t as 0ns address hold time t ah 0ns bs delay time t bsd 12ns cs delay time 1 t csd1 1.5 12 ns cs delay time 2 t csd2 12ns read write delay time t rwd 1.5 12 ns read write setup time t rws 0ns read write hold time t rwh 0ns read strobe delay time t rsd 12ns read data setup time 1 t rds1 12 ns read data setup time 2 t rds2 8ns read data hold time 1 t rdh1 0ns read data hold time 2 t rdh2 3ns write enable delay time t wed 12ns write data delay time 1 t wdd1 15ns write data delay time 2 t wdd2 13ns write data setup time t wds 0ns write data hold time 1 t wdh1 0ns write data hold time 2 t wdh2 1.5 ns write data hold time 3 t wdh3 0ns write data hold time 4 t wdh4 0ns wait setup time* 2 t wts 12 ns wait hold time* 2 t wth 4ns
504 table 17.7 bus timing (conditions: clock mode 0/1/2/7, v cc = 3.15C3.6 v, ta = C20 to 75 c) (cont) C60* 1 item symbol min max unit figure ras delay time 1 t rasd1 13 ns 17.23C17.44 ras delay time 2 t rasd2 1.5 13 ns cas delay time 1 t casd1 13 ns cas delay time 2 t casd2 1.5 13 ns dqm delay time t dqmd 1.5 12 ns cke delay time t cked 12 ns ce delay time t ced 13 ns 17.45C17.51 oe , rfsh delay time t oed 13 ns iciord delay time t icrsd 12 ns 17.56C17.58 iciowr delay time t icwsd 12 ns iois16 setup time t io16s 12 ns iois16 hold time t io16h 4ns notes 1. upper limit of external bus clock is 60 mhz. 2. wait is a synchronous signal. operation cannot be guaranteed if the setup and hold times shown here are not observed.
505 table 17.8 bus timing (conditions: clock mode 3/4, v cc = 3.15C3.6 v, ta = C20 to 75 c) item symbol min max unit figure address delay time t ad 1.5 20 ns 17.17C17.58 address setup time t as 0ns address hold time t ah 20 ns bs delay time t bsd 19ns cs delay time 1 t csd1 1.5 19 ns cs delay time 2 t csd2 20ns read write delay time t rwd 1.5 19 ns read write setup time t rws 0ns read write hold time t rwh 0ns read strobe delay time t rsd 20ns read data setup time 1 t rds1 12 ns read data setup time 2 t rds2 12 ns read data hold time 1 t rdh1 0ns read data hold time 2 t rdh2 8ns write enable delay time t wed 20ns write data delay time 1 t wdd1 25ns write data delay time 2 t wdd2 19ns write data setup time t wds 0ns write data hold time 1 t wdh1 0ns write data hold time 2 t wdh2 1.5 ns write data hold time 3 t wdh3 0ns write data hold time 4 t wdh4 0ns wait setup time t wts 12 ns wait hold time t wth 8ns
506 table 17.8 bus timing (conditions: clock mode 3/4, v cc = 3.15C3.6 v, ta = C20 to 75 c) (cont) item symbol min max unit figure ras delay time 1 t rasd1 20 ns 17.23C17.44 ras delay time 2 t rasd2 1.5 19 ns cas delay time 1 t casd1 20ns cas delay time 2 t casd2 1.5 19 ns dqm delay time t dqmd 1.5 19 ns cke delay time t cked 19ns ce delay time t ced 20 ns 17.45C17.51 oe , rfsh delay time t oed 20ns iciord delay time t icrsd 20 ns 17.56C17.58 iciowr delay time t icwsd 20ns iois16 setup time t io16s 12 ns iois16 hold time t io16h 8ns
507 17.3.4 basic timing t 1 ckio a25?0 csn rd/ wr rd (read) d31?0 (read) wen (write) d31?0 (write) bs t 2 t ad t ah t ad t csd1 t rwd t rsd t csd2 t wed t wdd1 t rds1 t bsd t bsd t rdh1 t rdh1 t wed t rsd t ah t rwh t rwd t wdh1 t rwh t rwh t ah t wdh3 figure 17.17 basic bus cycle (no wait)
508 t 1 t w t 2 ckio a25?0 csn rd/ wr rd (read) d31?0 (read) wen (write) d31?0 (write) bs wait t ad t ad t rwd t rwh t ah t ah t rsd1 t csd1 t wed1 t wdd1 t bsd t wts t wth t bsd t rds1 t csd2 t wed t rsd t rdh1 t rdh1 t rwd t ah t rwh t wdh3 t wdh1 t rwh figure 17.18 basic bus cycle (1 wait)
509 t 1 t w t w t 2 ckio a25?0 csn rd/ wr rd (read) d31?0 (read) wen (write) d31?0 (write) bs wait t ad t ad t rwd t rsd t wed t wdd1 t wts t wth t bsd t bsd t rds1 t wts t wth t csd1 t csd2 t rsd t wed t rdh1 t ah t rwh t rdh1 t ah t rwh t rwd t rwh t ah t wdh3 t wdh1 figure 17.19 basic bus cycle (external wait)
510 17.3.5 burst rom timing ckio a25?4 a3?0 csn rd/ we rd d31?0 bs wait t ad t ad t ad t ad t csd1 t rwd t bsd t bsd t ah t bsd t bsd t csd2 t rsd t rds1 t wts t wth t rds t rsd t 1 t b2 t b1 t b2 t b1 t b2 t b1 t 2 t rsd t rdh1 t rsd t ah t rdh1 t rwh t ah t rwh t rwd t rdh1 note: in the write cycle, the basic bus cycle is performed. figure 17.20 burst rom bus cycle (no wait)
511 ckio a25ea4 a3ea0 csn rd/ we rd d31?0 bs wait t ad t ad t ad t csd1 t rwh t rwd t rsd t rsd t rdh1 t rdh1 t rdh1 t rds1 t bsd t bsd t bsd t bsd t wts t wth t wts t wth t wts t wth t wts t wth t 1 t w t w t b2 t b1 t b2 t w t 2 t 2 t csd2 t rds1 t rsd t rsd t ah t ah t rdh1 t ah t rsd t rwd t rwh note: in the write cycle, the basic bus cycle is performed. figure 17.21 burst rom bus cycle (2 waits)
512 ckio a25?4 a3?0 csn rd/ we rd d31 to d0 bs wait t 1 t w t w t b2 t b1 t 2 t bw t ad t ad t csd1 t csd2 t rwd t rwh t rdh1 t ah t ah t rwd t rsd t rsd1 t ah t ad t bsd t bsd t wts t wth t wts t wth t wts t wth t wts t wth t bsd t bsd t rds1 t rdh1 t rsd t rdh1 t rwh t rsd1 note: in the write cycle, the basic bus cycle is performed. t rds figure 17.22 burst rom bus cycle (external wait input)
513 17.3.6 dram timing t ad t ad t bsd t csd1 t csd1 t bsd t rds1 t r t c1 t c2 (t pc ) ckio a25 to a16 a15 to a0 rd/ wr ras casxx d31?0 (read) d31?0 (write) cs2 or cs3 bs row address t ad t rwd t ah t ad t as t as row address column address t rasd1 t casd1 t wds t rasd1 t rwh t ah t rwh t ah t casd1 t rdh1 t wdd2 t rwd t wdh3 t wdh1 figure 17.23 dram bus cycle (rcd = 0, anw = 1, tpc = 0)
514 t wdh1 t wdh3 t bsd t csd1 t csd1 t bsd t rds1 t r t rw t rw t c1 t cw t c2 (t pc )(t pc ) ckio a25 to a16 a15 to a0 rd/ wr ras casxx d31?0 (read) d31?0 (write) cs2 or cs3 bs t ad t ad t ad t as t ad t as row address row address column address t rasd1 t rasd1 t rwh t ah t rwh t ah t casd1 t casd1 t wds t rwd t ah t rdh1 t wdd2 t rwd figure 17.24 dram bus cycle (rcd = 2, anw = 2, tpc = 1)
515 t r ckio a25?16 a15?0 rd/ wr ras casxx d31?0 (read) d31?0 (write) cs2 or cs3 bs t c1 t c2 t c1 t c2 t c1 t c2 t c1 t c2 (t pc ) t ad row address t ad column address column address column address column address t bsd t bsd t wdh3 t wdh3 t csd1 t csd1 t rasd1 t rwh t ah t rasd1 t casd1 t casd1 t casd1 t ah t rds1 t wds t rdh1 t casd1 t rwd t ah t ad t ad t ad t as t as row address t rwd t rds1 t rdh1 t wdd2 t rwh t wdd2 t wdh1 figure 17.25 dram burst bus cycle (rcd = 0, anw = 1, tpc = 0)
516 ckio rd/ wr d31?0 (read) d31?0 (write) ras casxx bs cs2 or cs3 a25?16 a15?0 t r t ad row address t ad t rwd t rwh t rdh1 t rdh1 t rds1 t wds t ah t ah t rwh t wdh3 t wdh1 t wdh3 t wdd2 t csd1 t bsd t bsd t csd1 t as t as t ad t c2 (t pc ) t rasd1 t cw t c1 t c2 t cw t c1 t rw t rw t ah t rwd t rasd1 t casd1 t rds1 t ad t ad row address t casd1 t casd1 t wdd2 column address column address row address figure 17.26 dram burst bus cycle (rcd = 2, anw = 2, tpc = 0)
517 ckio rd/ wr d31?0 (read) d31?0 (write) ras casxx bs cs2 or cs3 a25?16 t r t c1 t c2 (t pc ) t ad t ad t as t ad t rasd1 t ad t as t ah t rwd t ah a15?0 t rwh t rwd t rasd2 t casd1 t casd1 t wdh3 t wdh1 t rdh2 t rds2 t wdd2 t bsd t bsd t csd1 t csd1 t wds row address row address column address figure 17.27 dram bus cycle (edo mode, rcd = 0, anw = 1, tpc = 0)
518 ckio rd/ wr d31?0 (read) d31?0 (write) ras casxx bs cs2 or cs3 a25?16 a15?0 t r t rw t rw t c1 t cw t c2 (t pc ) (t pc ) t rwh t rwd row address t ad t ad t rwd t rasd1 t ah t ad t as t ad t ah t as t rasd2 t casd1 t wdh3 t wdh1 t wds t rds2 t rdh2 t casd1 t bsd t bsd t csd1 t csd1 row address column address t wdd2 figure 17.28 dram bus cycle (edo mode, rcd = 2, anw = 2, tpc = 1)
519 ckio rd/ wr d31?0 (read) d31?0 (write) ras casxx bs cs2 or cs3 a25?16 a15?0 t r t ad row address column address column address t ad t ad t rwd t wdh3 t rds2 t rds2 t wds t rdh2 t wdh3 t csd1 t bsd t bsd t csd1 t as t as t ah t ah t ah t rwh t ad t ad t c2 (t pc ) t wdh1 t wdd2 t c1 t c2 t c1 t c2 t c1 t c2 t c1 t rwd t rasd1 t casd1 t casd1 t casd1 t casd1 row address t rasd2 t rdh2 t wdd2 column address column address row address figure 17.29 dram burst bus cycle (edo mode, rcd = 0, anw = 1, tpc = 0)
520 ckio rd/ wr d31?0 (read) d31?0 (write) ras casxx bs cs2 or cs3 a25?16 a15?0 t r row address row address t c2 (t pc ) t cw t c1 t c2 t cw t c1 t rw t rw t ad t ad t ah t ah t rdh2 t wdh3 t wdd2 t wdh1 t wdh3 t rds2 t rwh t rwd t ah t ad t as t ad t ad t as t rwd t rasd1 t rasd2 t rdh2 t rds2 t casd1 t casd1 t wdd2 t wds t bsd t csd1 t csd1 t bsd t casd1 column address column address figure 17.30 dram burst bus cycle (edo mode, rcd = 2, anw = 2, tpc = 0)
521 t rc t rr1 t rrw t rr2 t rasd1 t rasd1 t casd1 t casd1 t rwd (high) (t pc ) ckio rd/ wr ras casxx cs2 or cs3 figure 17.31 dram cas-before-ras refresh cycle (tras = 0, tpc = 0) t rc t rr1 t rrw t rrw t rrw t rrw t rr2 t rasd1 t rasd1 t casd1 t casd1 t rwd (high) (t pc )(t pc )(t pc ) ckio rd/ wr ras casxx cs2 or cs3 figure 17.32 dram cas-before-ras refresh cycle (tras = 3, tpc = 2)
522 t rc t rr1 t rrw t sr1 t sr1 t sr2 (t pc ) t rasd1 t rasd1 t casd1 t casd1 t rwd (high) (t pc ) ckio rd/ wr ras casxx cs2 or cs3 figure 17.33 dram self-refresh cycle (tpc = 0)
523 17.3.7 synchronous dram timing t r t c1 t c2 (t pc ) ckio a25?16 a12 or a10 a15?0 rd/ wr ras cas dqmxx d31?0 bs cke t csd1 t csd1 t rasd2 t rasd2 t casd2 t casd2 t dqmd t dqmd t bsd t bsd (high) t rdh2 t rds2 csn t ad t ad row address t ad t ad t ad t ad row address row address column address t ad t ad read a command t rwd t rwd figure 17.34 synchronous dram read bus cycle (rcd = 0, cas latency = 1, tpc = 0)
524 ckio a25?16 a12 or a10 a15?0 rd/ wr ras cas dqmxx d31?0 bs cke t csd1 t csd1 t rasd2 t rasd2 t casd2 t casd2 t dqmd t dqmd t bsd t bsd (high) t rdh2 t rds2 csn t ad t ad t ad t ad t ad t ad t ad t ad t rwd t rwd t r t rw t rw t c1 t cw t d1 (t pc )(t pc ) column address row address row address row address read a command figure 17.35 synchronous dram read bus cycle (rcd = 2, cas latency = 2, tpc = 1)
525 ckio a25?16 a12 or a10 a15?0 rd/ wr ras cas dqmxx d31?0 bs cke csn t r t c1 t c2 /t d1 t c3 /t d2 t c4 /t d3 t d4 (t pc )(t pc ) t ad t ad t ad t ad t ad t ad row address read a command t ad t ad t ad column address (1e4) read command row address row address t csd1 t csd1 t rwd t rwd t casd2 t casd2 t dqmd t dqmd t bsd t bsd t rdh2 t rds2 t rdh2 t rds2 t rasd2 t rasd2 (high) figure 17.36 synchronous dram read bus cycle (burst read (single read 4), rcd = 0, cas latency = 1, tpc = 1)
526 t r t rw t c1 t c2 t c3 t c4 /t d1 t d2 t d3 t d4 (t pc ) ckio a25?16 a12 or a10 a15?0 rd/ wr ras cas dqmxx d31?0 bs cke csn (high) t ad t ad t ad t ad t ad row address row address row address t ad t ad t ad t ad t ad t rwd t rwd read command t csd1 t csd1 t casd2 t casd2 t dqmd t dqmd t bsd t bsd t rdh2 t rds2 t rdh2 t rds2 t rasd2 t rasd2 column address (1?) figure 17.37 synchronous dram read bus cycle (burst read (single read 4), rcd = 1, cas latency = 3, tpc = 0)
527 t r t c1 (t rwl ) (tpc) ckio a25?16 a12 or a10 a15?0 rd/ wr ras cas dqmxx d31?0 bs cke t csd1 t csd1 t rasd2 t rasd2 t casd2 t casd2 t dqmd t dqmd t bsd t bsd (high) t wdh2 t wdd2 csn t ad t ad row address t ad t ad t ad t ad row address row address t ad t ad write a command t rwd t rwd t rwd column address figure 17.38 synchronous dram write bus cycle (rcd = 0, tpc = 0, trwl = 0)
528 ckio a25?16 a12 or a10 a15?0 rd/ wr ras cas dqmxx d3?0 bs cke csn t r t rw t rw t c1 (t rwl )(t rwl )(t pc ) (t pc ) t csd1 t csd1 t rasd2 t rasd2 t casd2 t casd2 t dqmd t dqmd t bsd t bsd (high) t wdh2 t wdd2 t ad t ad row address t ad t ad t ad t ad row address t ad t ad t ad t rwd t rwd t rwd t ad row address write a command column address figure 17.39 synchronous dram write bus cycle (rcd = 2, tpc = 1, trwl = 1)
529 ckio a25?16 a12 or a10 a15?0 rd/ wr ras cas dqmxx d31?0 bs cke csn t r t c1 t c2 t c3 t c4 (t rwl )(t pc )(t pc ) t ad t ad t ad t ad t ad t ad write command row address write a command t ad t ad t ad column address (1?) row address t csd1 t csd1 t casd2 t casd2 t dqmd t dqmd t bsd t bsd t wdh2 t wdd2 t wdd2 t rasd2 t rasd2 t rwd t rwd t rwd row address (high) figure 17.40 synchronous dram write bus cycle (burst mode (single write 4), rcd = 0, tpc = 1, trwl = 0)
530 t r t rw t c1 t c2 t c3 t c4 (t rwl ) (t pc ) ckio a25?16 a12 or a10 a15?0 rd/ wr ras cas dqmxx d31?0 bs cke csn (high) t ad t ad t ad t ad row address row address row address t ad t ad t ad t ad t rwd t rwd t rwd write command t ad t csd1 t csd1 t casd2 t casd2 t dqmd t dqmd t bsd t bsd t wdd2 t wdd2 t rasd2 t rasd2 column address (1e4) write a command t wdh2 figure 17.41 synchronous dram write bus cycle (burst mode (single write 4), rcd = 1, tpc = 0, trwl = 0)
531 ckio cke t rr t rrw t rrw (t pc ) (t pc ) (high) t csd1 t csd1 t rasd2 t rasd2 t casd2 t casd2 t rwd rd/ wr ras cas csn figure 17.42 synchronous dram auto-refresh cycle (tras = 1, tpc = 1)
532 ckio cke t rs1 (t rs2 ) (t rs2 ) t rs3 (t pc ) (t pc ) t csd1 t csd1 t cked t cked t rasd2 t rasd2 t casd2 t casd2 t rwd t rwd rd/ wr ras cas csn figure 17.43 synchronous dram self-refresh cycle (tpc = 0)
533 ckio a13 or a11 a12 or a10 a11?2 or a9?2 rd/ wr (high) ras casxx d31?0 cke csn t rp1 t rp2 t rp3 t rp4 t mw1 t mw2 t mw3 t mw4 t ad t ad t ad t ad t ad t ad t csd1 t ad t ad t ad t ad t ad t rasd2 t rasd2 t rasd2 t rasd2 t csd1 t rwd t rwd t rwd t casd2 t casd2 figure 17.44 synchronous dram mode register write cycle
534 17.3.8 pseudo-sram timing t ad t as t ad t wdh3 t bsd t bsd t oed t wed t wds t rds1 a25?0 rd/ wr ce oe / rfsh (read) d31?0 (read) wen (write) d31?0 (write) bs t rwd t r t c1 t c2 (t pc ) ckio t rws t ced t rdh1 t rwd t rwh t ced t ah t oed t rwh t ah t wed t rwh t ah t wdd2 t wdh1 figure 17.45 pseudo-sram bus cycle (rcd = 0, a3w = 1, tpc = 0)
535 t ad t as t ad t wds t wdh3 t bsd t bsd t oed t rds1 a25?0 rd/ wr ce oe / rfsh (read) wen (write) d31?0 (read) d31?0 (write) bs ckio t r t rw t c1 t c1w t c1w t c2 (t pc ) t rdh1 t wed t wed t rwh t ah t rwd t rws t rwd t ced t oed t ah t ced t ah t rwh t rwh t wdd2 t wdh1 figure 17.46 pseudo-sram read cycle (rcd = 1, a3w = 3, tpc = 0)
536 ckio a25?4 rd/ wr oe / rfsh (read) ce wen (write) d31?0 (read) d31?0 (write) bs t ad t as t r t c1 t c2 t c1 t c2 t c1 t c2 t c1 t c2 (t pc ) t ad t bsd t bsd t bsd t bsd t ced t ced t ah t oed t oed t oed t ah t wed t as t as t wed t wds t wdh3 t wdh3 t rds1 t rds1 t rwd t rws t rwd t wed t wed t oed t ah t wdd2 t wdd2 t wdh1 a3?0 t ad t rwh t rwh t rdh1 t rwh t rdh1 figure 17.47 pseudo-sram bus cycle (static column mode, rcd = 0, a3w = 1, tpc = 0)
537 ckio a25?4 rd/ wr oe / rfsh (read) ce wen (write) d31?0 (read) d31?0 (write) bs t r t rw t c1 t c1w t c2 t c1 t c1w t c2 (t pc )(t pc ) t bsd t bsd t bsd t bsd t ad t as a3?0 t ad t rwd t rws t rds1 t oed t oed t oed t wed t wed t wds t wdh3 t wdh3 t wed t rdh1 t rds1 t ced t rwh t ah t rwh t rwh t ah t ah t oed t wed t ced t rwd t ad t as t wdd2 t wdd2 t wdh1 t rdh1 figure 17.48 pseudo-sram bus cycle (static column mode, rcd = 1, a3w = 2, tpc = 1)
538 ckio (high) oe / rfsh ce t rc t rr1 t rr2 (t pc ) t oed t oed figure 17.49 pseudo-sram auto-refresh cycle (tras = 1, tpc = 1) ckio oe / rfsh ce t rc t rr1 t rrw t rrw t rr2 (t pc )(t pc ) t oed t oed (high) figure 17.50 pseudo-sram auto-refresh cycle (tras = 2, tpc = 1) ckio (high) oe / rfsh ce t rc t rr1 t sr t sr2 (t pc )(t pc ) t oed t oed figure 17.51 pseudo-sram self-refresh cycle (tpc = 0)
539 17.3.9 pcmcia timing t pcm1 t pcm2 ckio a25?0 cexx rd/ wr rd (read) d15?0 (read) we1 (write) d15?0 (write) bs t ad t ad t csd1 t csd1 t rwd t rsd t rsd t rwd t wed t wdd1 t wed t rds1 t rdh1 t bsd t bsd t wdh4 t wdh1 figure 17.52 pcmcia memory bus cycle (ted = 0, teh = 0, no wait)
540 ckio t pcm0 t pcm0w t pcm1 t pcm1w t pcm1w t pcm2 t pcm2w a25?0 cexx rd/ wr rd (read) d15?0 (read) we1 (write) d15?0 (write) bs wait t ad t csd1 t rwd t ad t csd1 t rwd t wdh4 t rsd t rsd t wed t wdd1 t wed1 t wdh1 t rdh1 t bsd t wts t wth t wts t wth t rds1 t bsd figure 17.53 pcmcia memory bus cycle (ted = 2, teh = 1, 1 wait, external wait)
541 ckio t pcm1 t pcm2 t pcm1 t pcm2 t pcm1 t pcm2 t pcm1 t pcm2 a25?4 a3?0 cexx rd/ wr rd (read) d15?0 (read) bs t ad t ad t csd1 t rwd t csd1 t rwd t ad t ad t ad t ad t rsd t rsd t rdh1 t rdh1 t rsd t rsd t bsd t bsd t bsd t bsd t rds1 t rds1 note: even though burst mode is set, write cycle operation is the same as in normal mode. figure 17.54 pcmcia memory bus cycle (burst read, ted = 0, teh = 0, no wait)
542 ckio t pcm0 t pcm1 t pcm1w t pcm1w t pcm1w t pcm2 t pcm1 t pcm1w t pcm2 t pcm2w a25?4 a3?0 cexx rd/ wr rd (read) d15?0 (read) bs wait t ad t ad t csd1 t rwd t csd1 t rwd t ad t ad t ad t rsd t rsd t rsd t rsd t bsd t bsd t bsd t bsd t rds1 t rdh1 t rdh1 t rds1 t wts t wth t wts t wts t wth t wth note: even though burst mode is set, the write cycle operation is the same as in normal mode. figure 17.55 pcmcia memory bus cycle (burst read, ted = 1, teh = 1, 2 waits, burst pitch = 3)
543 t pci1 t pci2 ckio a25?0 cexx rd/ wr iciord (read) d15?0 (read) iciowr (write) d15?0 (write) bs t ad t ad t csd1 t csd1 t rwd t icrsd t icrsd t rwd t icwsd t wdd1 t icwsd t rdh1 t rds1 t bsd t bsd t wdh1 t wdh4 figure 17.56 pcmcia i/o bus cycle (ted = 0, teh = 0, no wait)
544 ckio t pci0 t pci0w t pci1 t pci1w t pci1w t pci2 t pci2w a25?0 cexx rd/ wr iciord (read) d15?0 (read) iciowr (write) d15?0 (write) bs wait iois16 t ad t csd1 t rwd t ad t csd1 t rwd t icrsd t icrsd t icwsd t wdd1 t icwsd t wdh1 t wdh4 t rdh1 t bsd t bsd t wts t wth t wts t wth t io16s t io16h t rds1 figure 17.57 pcmcia i/o bus cycle (ted = 2, teh = 1, 1 wait, external wait)
545 ckio t pci0 t pci1 t pci1w t pci2 t pci1 t pci1w t pci2 t pci2w a25?4 a0 cexx rd/ wr iciord (read) d15?0 (read) iciowr (write) d15?0 (write) bs wait iois16 t ad t ad t csd1 t csd1 t rwd t rwd t wdd1 t wdh3 t wdh4 t bsd t bsd t ad t ad t icrsd t icrsd t icrsd t icrsd t icwsd t wts t wth t wth t io16s t io16h t ad t rds1 t csd1 t rds1 t icwsd t icwsd t icwsd t rdh1 t rdh1 t wdd2 t wdh1 t bsd t bsd t wts figure 17.58 pcmcia i/o bus cycle (ted = 1, teh = 1, 1 wait, bus sizing)
546 17.3.10 peripheral module signal timing table 17.9 peripheral module signal timing (conditions: v cc = 3.15C3.6 v, ta = C20 to 75 c) C60 module item symbol min max unit figure tmu, timer input setup time t clks 12 ns 17.59 rtc timer clock input setup time t cks 12 ns 17.60 timer clock single edge t tckwh 1.5 tcyc pulse width both edges t tckwl 2.5 tcyc oscillation settling time t rosc 3 s 17.61 sci input clock cycle asynchronous t scyc 4 tcyc 17.62C17.63 synchronous 6 tcyc input clock rise time t sckr 1.5 tcyc 17.62 input clock fall time t sckf 1.5 tcyc input clock pulse width t sckw 0.4 0.6 tscyc transmit data delay time t txd 100 ns 17.63 receive data setup time (synchronous) t rxs 100 ns receive data hold time (synchronous) t rxh 100 ns port output data delay time t portd 15 ns 17.64 input data setup time t ports 12 ns input data hold time t porth 5ns
547 t tclks ckio tclk (input) figure 17.59 tclk input timing (1) t tcks t tcks t tckwh t tckwl ckio tclk (input) figure 17.60 tclk input timing (2) rtc crystal oscillator stable oscillation v cc v ccmin t rosc figure 17.61 rtc crystal oscillator power-on oscillation settling time t sckw t sckr t sckf t scyc sck figure 17.62 sck input clock timing
548 t scyc t txd sck txd (data trans- mission) rxd (data reception) t rxh t rxs figure 17.63 synchronous mode sci input/output timing t ports f port 7 port 0 (read) port 7 port 0 (write) t porth t portd figure 17.64 i/o port input/output timing
549 17.3.11 ac characteristics test conditions input/output signal reference level: 1.5 v (v cc = 3.3C3.6v). input pulse level: v ss to 3.0 v (when reset , breq , nmi, irl3 C irl0 , ckio, md5C md0 are v ss to v cc ). input rise/fall time: 1 ns iol cl vref ioh lsi output pin dut output notes: 1. 2. c l is the total capacitance including the test jig probe, as shown below: 30 pf: ckio, ras , casxx , cso cs6 , ce2a , ce2b , back 50 pf: all other pins i ol and i oh are the values shown in table 17.3 figure 17.65 output load circui
550
551 appendix a pin functions a . 1 pin states table a.1 shows pin states during resets, power-down states, and the bus-released state. table a.1 pin states during resets, power-down states, and bus-released state bus- power-on manual power-down state released category pin reset reset standby sleep state clock ckio io *1 io *1 io *1 io *1 io *1 extal i *1 i *1 i *1 i *1 i *1 xtal o *1 o *1 o *1 o *1 o *1 extal2 iiiii xtal 2ooooo system control reset iiiii breq iiiii back ooool ca iiiii status0, status1 ooooo md0/sck iiiio *2 io *2 md1/txd iiiio *3 io *3 md2/rxd iiiii md3/ ce2a iih *4 izh *7 ih *4 iz *4 md4/ ce2b iih *4 izh *7 ih *4 iz *4 md5/ ras2 iio *5 izo *6 io *5 izo *6 interrupt nmi iiiii irl3 to irl0 iiiii irqout ooooo
552 table a.1 pin states during resets, power-down states, and bus-released state (cont) bus- power-on manual power-down state released category pin reset reset standby sleep state address bus a25 to a0 o o z o z data bus d31 to d30 z zo *8 zo *8 zo *8 zo *8 d29 to d24 zzzzz d23 to d16/ port7 to port0 zzk *10 zk *10 zk *10 zk *10 d15 to d0 z i z i z bus control cs0 to cs4 hozh *13 hz cs5 / ce1a hozh *13 hz cs6 / ce1b hozh *13 hz bs hozh *13 hz ras / ce hozo *11 ozo *11 casll / cas / oe hozo *11 ozo *11 caslh hozo *11 ozo *11 cashl / cas2l hozo *11 ozo *11 cashh / cas2h hozo *11 ozo *11 dqmll/ we0 hozh *13 hz dqmlu/ we1 hozh *13 hz dqmul/ we2 / iciord hozh *13 hz dqmuu/ we3 / iciowr hozh *13 hz rd/ wr hozh *13 hz rd hozh *13 hz cke hoooo wait zi zi z iois16 zi zi z tmu/rtc tclk z z io *14 io *12 io *12 pll cap1, cap2 io io io io io i: input o: output h: high-level output
553 l: low-level output z: high impedance k: input pin is high impedance, output pin holds its state notes: 1. dependent on the clock mode (md2?d0 setting). 2. when sci and port are not used, i. when used, i or o depending on register setting. 3. when sci and port are not used, i. when used, o. 4. when pcmcia is not used, i. when used, h or z. 5. when area 2 dram is not used, i. when used, o. 6. when area 2 dram is not used, i. when used, z or o depending on register setting. 7. when pcmcia is not used, i. when used, z or h depending on register setting. 8. o when the port function is used. 9. z when the port function is used. 10. when the port function is used, k depending on register setting. 11. z or o depending on register setting. 12. i or o depending on register setting. 13. z or h depending on register setting. 14. in standby mode, i or o depending on register setting. in hardware standby mode, i or l depending on register setting.
554 a . 2 pin specifications table a.2 shows the pin specifications. table a.2 pin specifications pin pin no. i / o function md5/ ras2 130 i/o operating mode pin (endian switching)/ras (for dram). md signal is fetched in at power-on reset. switched to ras2 on area 2 dram enabling by register. md4/ ce2b 103 i/o operating mode pin (area 0 bus width)/pcmcia ce pin. md signal is fetched in at power-on reset. switched to ce2b on area 6 pcmcia enabling by register. md3/ ce2a 104 i/o operating mode pin (area 0 bus width)/pcmcia ce pin. md signal is fetched in at power-on reset. switched to ce2a on area 5 pcmcia enabling by register. md2/rxd 84 i operating mode pin/serial data input. md signal is fetched in at power-on reset. switched to rxd on sci enabling by register. md1/txd 85 i/o operating mode pin/serial data output. md signal is fetched in at power-on reset. switched to txd on sci enabling by register. md0/sck 86 i/o operating mode pin/serial clock. md signal is fetched in at power-on reset. switched to sck on sci enabling by register. status1 97 o processor status status0 98 o processor status a25 to a0 72 to 70, 67 to 61, 58 to 56, 53 to 51, 48 to 43, 40 to 37 o address bus d31 to d24 140 to 143, 1 to 4 i/o data bus d23 to d16/ port 7 to port 0 5, 8 to 14 i/o data bus / i/o port
555 table a.2 pin specifications (cont) pin pin no. i / o function d15 to d0 15 to 16, 21 to 29, 32 to 36 i/o data bus cs6 / ce1b 108 o chip select 6/pcmcia ce cs5 / ce1a 109 o chip select 5/pcmcia ce cs4 to cs0 110 to 114 o chip select 4?hip select 0 bs 105 o bus cycle start ras / ce 129 o dram, synchronous dram ras /pseudo-sram ce cashh / cas2h 119 o d31?24 (dram cas )/d15?8 (area 2 dram cas ) select signal cashl / cas2l 120 o d23-d16 (dram cas )/d7?0 (area 2 dram cas ) select signal caslh 125 o d15?8 select signal (dram cas ) casll / cas / oe 126 o d7?0 select (dram cas )/memory select signal (synchronous dram cas /pseudo-sram oe ) we3 /dqmuu/ iciowr 117 o d31?24 select signal (normal memory, pseudo-sram we /synchronous dram dqm)/io write (pcmcia, pcmcib) we2/dqmul/ iciord 118 o d23?16 select signal (normal memory, pseudo-sram we /synchronous dram dqm)/io write (pcmcia, pcmcib) we1 /dqmlu 123 o d15?8 select signal (normal memory, pseudo-sram we/synchronous dram dqm) we0 /dqmll 124 o d7?0 select signal (normal memory, pseudo-sram we/synchronous dram dqm) rd/ wr 106 o read/write (synchronous dram/dram/pcmcia) rd 107 o read pulse (pcmcia/normal memory) wait 132 i hardware wait request iois16 94 i io16 bit indication (pcmcia io area) breq 87 i bus request back 96 o bus acknowledge irqout 95 o interrupt request notification reset 88 i reset ca 81 i chip active causes a transition to hardware standby mode when low. drive high in a power-on reset.
556 table a.2 pin specifications (cont) pin pin no. i / o function nmi 89 i nonmaskable interrupt request irl3 to irl0 90 to 93 i external interrupt source input tclk 134 i/o timer external clock input/rtc clock output extal 79 i external clock/crystal resonator pin xtal 80 o crystal resonator pin cap1 74 o external capacitance pin (for pll1) cap2 77 o external capacitance pin (for pll1) ckio 101 i/o system clock input/output cke 131 o clock enable control (for synchronous dram) xtal2 136 o crystal resonator pin (for on-chip rtc) extal2 137 i crystal resonator pin (for on-chip rtc) nc 99 o leave unconnected v cc 7, 18, 20, 31, 42, 50, 55, 60, 69, 81, 83, 102, 116, 122, 128, 139 power supply power supply (3.3 v) v cc (rtc) 135 power supply rtc oscillator power supply (3.3 v) v cc (pll) 75, 78 power supply pll power supply (3.3 v) v ss 6, 17, 19, 30, 41, 49, 54, 59, 68, 82, 100, 115, 121, 127, 133, 144 power supply power supply (0 v) v ss (rtc) 138 power supply rtc oscillator power supply (0 v) v ss (pll) 73, 76 power supply pll power supply (0 v) note: except in hardware standby mode, power must be supplied constantly to all power supply pins. in hardware standby mode, power should be supplied at least to the rtc power supply pins.
557 a . 3 handling of unused pins when rtc is not used ? extal2: pull up ? xtal2: leave unconnected ? v cc (rtc): power supply (3.3 v) ? v ss (rtc): power supply (0 v) when pll1 is not used ? cap1: leave unconnected ? v cc (pll): power supply (3.3 v) ? v ss (pll): power supply (0 v) when pll2 is not used ? cap2: leave unconnected ? v cc (pll): power supply (3.3 v) ? v ss (pll): power supply (0 v) when on-chip crystal oscillator is not used ? xtal: leave unconnected
558 a . 4 pin states in access to each address space table a.3 pin states (normal memory/little-endian) 8-bit bus width 16-bit bus width pin byte/word/long- word access byte access (address 2n) byte access (address 2n + 1) word/longword access cs6 to cs0 enabled enabled enabled enabled rd r low low low low w high high high high rd/ wr r high high high high w low low low low bs enabled enabled enabled enabled ras / ce high high high high cas / casll / oe high high high high caslh high high high high cashl / cas2l high high high high cashh / cas2h high high high high dqmll/ we0 r high high high high w low low high low dqmlu/ we1 r high high high high w high high low low dqmul/ we2 / iciord r high high high high w high high high high dqmuu/ we3 / iciowr r high high high high w high high high high md3/ ce2a high-z or high *1 high-z or high *1 high-z or high *1 high-z or high *1 md4/ ce2b high-z or high *2 high-z or high *2 high-z or high *2 high-z or high *2 md5/ ras2 high-z or high *3 high-z or high *3 high-z or high *3 high-z or high *3 cke disabled disabled disabled disabled wait enabled *4 enabled *4 enabled *4 enabled *4 iois16 disabled disabled disabled disabled a25 to a0 address address address address d7 to d0 valid data valid data invalid data valid data d15 to d8 high-z invalid data valid data valid data d23 to d16/ port7 to port0 high-z *5 high-z *5 high-z *5 high-z *5 d31 to d24 high-z *6 high-z *6 high-z *6 high-z *6
559 table a.3 pin states (normal memory/little-endian) (cont) 32-bit bus width pin byte access (address 4n) byte access (address 4n + 1) byte access (address 4n + 2) byte access (address 4n + 3) word access (address 4n) word access (address 4n + 2) longword access cs6 to cs0 enabled enabled enabled enabled enabled enabled enabled rd r low low low low low low low w high high high high high high high rd/ wr r high high high high high high high w low low low low low low low bs enabled enabled enabled enabled enabled enabled enabled ras / ce high high high high high high high cas / casll / oe high high high high high high high caslh high high high high high high high cashl / cas2l high high high high high high high cashh / cas2h high high high high high high high dqmll/ we0 r high high high high high high high w low high high high low high low dqmlu/ we1 r high high high high high high high w high low high high low high low dqmul/ we2 / iciord r high high high high high high high w high high low high high low low dqmuu/ we3 / iciowr r high high high high high high high w high high high low high low low md3/ ce2a high-z or high *1 high-z or high *1 high-z or high *1 high-z or high *1 high-z or high *1 high-z or high *1 high-z or high *1 md4/ ce2b high-z or high *2 high-z or high *2 high-z or high *2 high-z or high *2 high-z or high *2 high-z or high *2 high-z or high *2 md5/ ras2 high-z or high *3 high-z or high *3 high-z or high *3 high-z or high *3 high-z or high *3 high-z or high *3 high-z or high *3 cke disabled disabled disabled disabled disabled disabled disabled wait enabled *4 enabled *4 enabled *4 enabled *4 enabled *4 enabled *4 enabled *4 iois16 disabled disabled disabled disabled disabled disabled disabled a25 to a0 address address address address address address address d7 to d0 valid data invalid data invalid data invalid data valid data invalid data valid data
560 table a.3 pin states (normal memory/little-endian) (cont) 32-bit bus width pin byte access (address 4n) byte access (address 4n + 1) byte access (address 4n + 2) byte access (address 4n + 3) word access (address 4n) word access (address 4n + 2) longword access d15 to d8 invalid data valid data invalid data invalid data valid data invalid data valid data d23 to d16/ port7 to port0 invalid data invalid data valid data invalid data invalid data valid data valid data d31 to d24 invalid data invalid data invalid data valid data invalid data valid data valid data notes: 1. when bcr1.a5pcm = 0, high-z. 2. when bcr1.a6pcm = 0, high-z. 3. when bcr1.dramtp (2?) 1 101, high-z. 4. when wcr2 register wait setting is 0, disabled. 5. when bcr2.porten = 0, high-z. when bcr2.porten = 1, dependent on pctr register. 6. when bcr2.porten = 0, high-z. when bcr2.porten = 1, d31 and d30 only data output.
561 table a.4 pin states (normal memory/big-endian) 8-bit bus width 16-bit bus width pin byte/word/long- word access byte access (address 2n) byte access (address 2n + 1) word/longword access cs6 to cs0 enabled enabled high enabled rd r low low low low w high high high high rd/ wr r high high high high w low low low low bs enabled enabled enabled enabled ras / ce high high high high cas / casll / oe high high high high caslh high high high high cashl / cas2l high high high high cashh / cas2h high high high high dqmll/ we0 r high high high high w low high low low dqmlu/ we1 r high high high high w high low high low dqmul/ we2 / iciord r high high high high w high high high high dqmuu/ we3 / iciowr r high high high high w high high high high md3/ ce2a high-z or high *1 high-z or high *1 high-z or high *1 high-z or high *1 md4/ ce2b high-z or high *2 high-z or high *2 high-z or high *2 high-z or high *2 md5/ ras2 high-z or high *3 high-z or high *3 high-z or high *3 high-z or high *3 cke disabled disabled disabled disabled wait enabled *4 enabled *4 enabled *4 enabled *4 iois16 disabled disabled disabled disabled a25 to a0 address address address address d7 to d0 valid data invalid data valid data valid data d15 to d8 high-z valid data invalid data valid data d23 to d16/ port7 to port0 high-z *5 high-z *5 high-z *5 high-z *5 d31 to d24 high-z *6 high-z *6 high-z *6 high-z *6
562 table a.4 pin states (normal memory/big-endian) (cont) 32-bit bus width pin byte access (address 4n) byte access (address 4n + 1) byte access (address 4n + 2) byte access (address 4n + 3) word access (address 4n) word access (address 4n + 2) longword access cs6 to cs0 enabled enabled enabled enabled enabled enabled enabled rd r low low low low low low low w high high high high high high high rd/ wr r high high high high high high high w low low low low low low low bs enabled enabled enabled enabled enabled enabled enabled ras / ce high high high high high high high cas / casll / oe high high high high high high high caslh high high high high high high high cashl / cas2l high high high high high high high cashh / cas2h high high high high high high high dqmll/ we0 r high high high high high high high w high high high low high low low dqmlu/ we1 r high high high high high high high w high high low high high low low dqmul/ we2 / iciord r high high high high high high high w high low high high low high low dqmuu/ we3 / iciowr r high high high high high high high w low high high high low high low md3/ ce2a high-z or high *1 high-z or high *1 high-z or high *1 high-z or high *1 high-z or high *1 high-z or high *1 high-z or high *1 md4/ ce2b high-z or high *2 high-z or high *2 high-z or high *2 high-z or high *2 high-z or high *2 high-z or high *2 high-z or high *2 md5/ ras2 high-z or high *3 high-z or high *3 high-z or high *3 high-z or high *3 high-z or high *3 high-z or high *3 high-z or high *3 cke disabled disabled disabled disabled disabled disabled disabled wait enabled *4 enabled *4 enabled *4 enabled *4 enabled *4 enabled *4 enabled *4 iois16 disabled disabled disabled disabled disabled disabled disabled a25 to a0 address address address address address address address d7 to d0 invalid data invalid data invalid data valid data invalid data valid data valid data
563 table a.4 pin states (normal memory/big-endian) (cont) 32-bit bus width pin byte access (address 4n) byte access (address 4n + 1) byte access (address 4n + 2) byte access (address 4n + 3) word access (address 4n) word access (address 4n + 2) longword access d15 to d8 invalid data invalid data valid data invalid data invalid data valid data valid data d23 to d16/ port7 to port0 invalid data valid data invalid data invalid data valid data invalid data valid data d31 to d24 valid data invalid data invalid data invalid data valid data invalid data valid data notes: 1. when bcr1.a5pcm = 0, high-z. 2. when bcr1.a6pcm = 0, high-z. 3. when bcr1.dramtp (2?) 1 101, high-z. 4. when wcr2 register wait setting is 0, disabled. 5. when bcr2.porten = 0, high-z. when bcr2.porten = 1, dependent on pctr register . 6. when bcr2.porten = 0, high-z. when bcr2.porten = 1, d31 and d30 only data output.
564 table a.5 pin states (burst rom/little-endian) 8-bit bus width 16-bit bus width pin byte/word/long- word access byte access (address 2n) byte access (address 2n + 1) word/longword access cs6 to cs0 enabled enabled enabled enabled rd r low low low low w rd/ wr r high high high high w bs enabled enabled enabled enabled ras / ce high high high high cas / casll / oe high high high high caslh high high high high cashl / cas2l high high high high cashh / cas2h high high high high dqmll/ we0 r high high high high w dqmlu/ we1 r high high high high w dqmul/ we2 / iciord r high high high high w dqmuu/ we3 / iciowr r high high high high w md3/ ce2a high-z or high *1 high-z or high *1 high-z or high *1 high-z or high *1 md4/ ce2b high-z or high *2 high-z or high *2 high-z or high *2 high-z or high *2 md5/ ras2 high-z or high *3 high-z or high *3 high-z or high *3 high-z or high *3 cke disabled disabled disabled disabled wait enabled *4 enabled *4 enabled *4 enabled *4 iois16 disabled disabled disabled disabled a25 to a0 address address address address d7 to d0 valid data valid data invalid data valid data d15 to d8 high-z invalid data valid data valid data d23 to d16/ port7 to port0 high-z *5 high-z *5 high-z *5 high-z *5 d31 to d24 high-z *6 high-z *6 high-z *6 high-z *6
565 table a.5 pin states (burst rom/little-endian) (cont) 32-bit bus width pin byte access (address 4n) byte access (address 4n + 1) byte access (address 4n + 2) byte access (address 4n + 3) word access (address 4n) word access (address 4n + 2) longword access cs6 to cs0 enabled enabled enabled enabled enabled enabled enabled rd r low low low low low low low w rd/ wr r high high high high high high high w bs enabled enabled enabled enabled enabled enabled enabled ras / ce high high high high high high high cas / casll / oe high high high high high high high caslh high high high high high high high cashl / cas2l high high high high high high high cashh / cas2h high high high high high high high dqmll/ we0 r high high high high high high high w dqmlu/ we1 r high high high high high high high w dqmul/ we2 / iciord r high high high high high high high w dqmuu/ we3 / iciowr r high high high high high high high w md3/ ce2a high-z or high *1 high-z or high *1 high-z or high *1 high-z or high *1 high-z or high *1 high-z or high *1 high-z or high *1 md4/ ce2b high-z or high *2 high-z or high *2 high-z or high *2 high-z or high *2 high-z or high *2 high-z or high *2 high-z or high *2 md5/ ras2 high-z or high *3 high-z or high *3 high-z or high *3 high-z or high *3 high-z or high *3 high-z or high *3 high-z or high *3 cke disabled disabled disabled disabled disabled disabled disabled wait enabled *4 enabled *4 enabled *4 enabled *4 enabled *4 enabled *4 enabled *4 iois16 disabled disabled disabled disabled disabled disabled disabled a25 to a0 address address address address address address address d7 to d0 valid data invalid data invalid data invalid data valid data invalid data valid data
566 table a.5 pin states (burst rom/little-endian) (cont) 32-bit bus width pin byte access (address 4n) byte access (address 4n + 1) byte access (address 4n + 2) byte access (address 4n + 3) word access (address 4n) word access (address 4n + 2) longword access d15 to d8 invalid data valid data invalid data invalid data valid data invalid data valid data d23 to d16/ port7 to port0 invalid data invalid data valid data invalid data invalid data valid data valid data d31 to d24 invalid data invalid data invalid data valid data invalid data valid data valid data notes: 1. when bcr1.a5pcm = 0, high-z. 2. when bcr1.a6pcm = 0, high-z. 3. when bcr1.dramtp (2?) 1 101, high-z. 4. when wcr2 register wait setting is 0, disabled. 5. when bcr2.porten = 0, high-z. when bcr2.porten = 1, dependent on pctr register. 6. when bcr2.porten = 0, high-z. when bcr2.porten = 1, d31 and d30 only data output.
567 table a.6 pin states (burst rom/big-endian) 8-bit bus width 16-bit bus width pin byte/word/long- word access byte access (address 2n) byte access (address 2n + 1) word/longword access cs6 to cs0 enabled enabled enabled enabled rd r low low low low w rd/ wr r high high high high w bs enabled enabled enabled enabled ras / ce high high high high cas / casll / oe high high high high caslh high high high high cashl / cas2l high high high high cashh / cas2h high high high high dqmll/ we0 r high high high high w dqmlu/ we1 r high high high high w dqmul/ we2 / iciord r high high high high w dqmuu/ we3 / iciowr r high high high high w md3/ ce2a high-z or high *1 high-z or high *1 high-z or high *1 high-z or high *1 md4/ ce2b high-z or high *2 high-z or high *2 high-z or high *2 high-z or high *2 md5/ ras2 high-z or high *3 high-z or high *3 high-z or high *3 high-z or high *3 cke disabled disabled disabled disabled wait enabled *4 enabled *4 enabled *4 enabled *4 iois16 disabled disabled disabled disabled a25 to a0 address address address address d7 to d0 valid data invalid data valid data valid data d15 to d8 high-z valid data invalid data valid data d23 to d16/ port7 to port0 high-z *5 high-z *5 high-z *5 high-z *5 d31 to d24 high-z *6 high-z *6 high-z *6 high-z *6
568 table a.6 pin states (burst rom/big-endian) (cont) 32-bit bus width pin byte access (address 4n) byte access (address 4n + 1) byte access (address 4n + 2) byte access (address 4n + 3) word access (address 4n) word access (address 4n + 2) longword access cs6 to cs0 enabled enabled enabled enabled enabled enabled enabled rd r low low low low low low low w rd/ wr r high high high high high high high w bs enabled enabled enabled enabled enabled enabled enabled ras / ce high high high high high high high cas / casll / oe high high high high high high high caslh high high high high high high high cashl / cas2l high high high high high high high cashh / cas2h high high high high high high high dqmll/ we0 r high high high high high high high w dqmlu/ we1 r high high high high high high high w dqmul/ we2 / iciord r high high high high high high high w dqmuu/ we3 / iciowr r high high high high high high high w md3/ ce2a high-z or high *1 high-z or high *1 high-z or high *1 high-z or high *1 high-z or high *1 high-z or high *1 high-z or high *1 md4/ ce2b high-z or high *2 high-z or high *2 high-z or high *2 high-z or high *2 high-z or high *2 high-z or high *2 high-z or high *2 md5/ ras2 high-z or high *3 high-z or high *3 high-z or high *3 high-z or high *3 high-z or high *3 high-z or high *3 high-z or high *3 cke disabled disabled disabled disabled disabled disabled disabled wait enabled *4 enabled *4 enabled *4 enabled *4 enabled *4 enabled *4 enabled *4 iois16 disabled disabled disabled disabled disabled disabled disabled a25 to a0 address address address address address address address d7 to d0 invalid data invalid data invalid data valid data invalid data valid data valid data
569 table a.6 pin states (burst rom/big-endian) (cont) 32-bit bus width pin byte access (address 4n) byte access (address 4n + 1) byte access (address 4n + 2) byte access (address 4n + 3) word access (address 4n) word access (address 4n + 2) longword access d15 to d8 invalid data invalid data valid data invalid data invalid data valid data valid data d23 to d16/ port7 to port0 invalid data valid data invalid data invalid data valid data invalid data valid data d31 to d24 valid data invalid data invalid data invalid data valid data invalid data valid data notes: 1. when bcr1.a5pcm = 0, high-z. 2. when bcr1.a6pcm = 0, high-z. 3. when bcr1.dramtp (2?) 1 101, high-z. 4. when wcr2 register wait setting is 0, disabled. 5. when bcr2.porten = 0, high-z. when bcr2.porten = 1, dependent on pctr register . 6. when bcr2.porten = 0, high-z. when bcr2.porten = 1, d31 and d30 only data output.
570 table a.7 pin states (dram/little-endian) 16-bit bus width (area 3) 16-bit bus width (area 2) pin byte access (address 2n) byte access (address 2n + 1) word/ longword access byte access (address 2n) byte access (address 2n + 1) word/ longword access cs6 to cs0 enabled enabled enabled enabled enabled enabled rd r high high high high high high w high high high high high high rd/ wr r high high high high high high w low low low low low low bs enabled enabled enabled enabled enabled enabled ras / ce low low low high high high cas / casll / oe low high low high high high caslh high low low high high high cashl / cas2l high high high low high low cashh / cas2h high high high high low low dqmll/ we0 r high high high high high high w high high high high high high dqmlu/ we1 r high high high high high high w high high high high high high dqmul/ we2 / iciord r high high high high high high w high high high high high high dqmuu/ we3 / iciowr r high high high high high high w high high high high high high md3/ ce2a high-z or high *1 high-z or high *1 high-z or high *1 high-z or high *1 high-z or high *1 high-z or high *1 md4/ ce2b high-z or high *2 high-z or high *2 high-z or high *2 high-z or high *2 high-z or high *2 high-z or high *2 md5/ ras2 high-z or high *3 high-z or high *3 high-z or high *3 low low low cke disabled disabled disabled disabled disabled disabled wait disabled disabled disabled disabled disabled disabled iois16 disabled disabled disabled disabled disabled disabled a25 to a0 address address address address address address d7 to d0 valid data invalid data valid data valid data invalid data valid data d15 to d8 invalid data valid data valid data invalid data valid data valid data
571 table a.7 pin states (dram/little-endian) (cont) 16-bit bus width (area 3) 16-bit bus width (area 2) pin byte access (address 2n) byte access (address 2n + 1) word/ longword access byte access (address 2n) byte access (address 2n + 1) word/ longword access d23 to d16/ port7 to port0 high-z *4 high-z *4 high-z *4 high-z *4 high-z *4 high-z *4 d31 to d24 high-z *5 high-z *5 high-z *5 high-z *5 high-z *5 high-z *5
572 table a.7 pin states (dram/little-endian) (cont) 32-bit bus width pin byte access (address 4n) byte access (address 4n + 1) byte access (address 4n + 2) byte access (address 4n + 3) word access (address 4n) word access (address 4n + 2) longword access cs6 to cs0 enabled enabled enabled enabled enabled enabled enabled rd r high high high high high high high w high high high high high high high rd/ wr r high high high high high high high w low low low low low low low bs enabled enabled enabled enabled enabled enabled enabled ras / ce low low low low low low low cas / casll / oe low high high high low high low caslh high low high high low high low cashl / cas2l high high low high high low low cashh / cas2h high high high low high low low dqmll/ we0 r high high high high high high high w high high high high high high high dqmlu/ we1 r high high high high high high high w high high high high high high high dqmul/ we2 / iciord r high high high high high high high w high high high high high high high dqmuu/ we3 / iciowr r high high high high high high high w high high high high high high high md3/ ce2a high-z or high *1 high-z or high *1 high-z or high *1 high-z or high *1 high-z or high *1 high-z or high *1 high-z or high *1 md4/ ce2b high-z or high *2 high-z or high *2 high-z or high *2 high-z or high *2 high-z or high *2 high-z or high *2 high-z or high *2 md5/ ras2 high-z high-z high-z high-z high-z high-z high-z cke disabled disabled disabled disabled disabled disabled disabled wait disabled disabled disabled disabled disabled disabled disabled iois16 disabled disabled disabled disabled disabled disabled disabled a25 to a0 address address address address address address address d7 to d0 valid data invalid data invalid data invalid data valid data invalid data valid data
573 table a.7 pin states (dram/little-endian) (cont) 32-bit bus width pin byte access (address 4n) byte access (address 4n + 1) byte access (address 4n + 2) byte access (address 4n + 3) word access (address 4n) word access (address 4n + 2) longword access d15 to d8 invalid data valid data invalid data invalid data valid data invalid data valid data d23 to d16/ port7 to port0 invalid data invalid data valid data invalid data invalid data valid data valid data d31 to d24 invalid data invalid data invalid data valid data invalid data valid data valid data notes: 1. when bcr1.a5pcm = 0, high-z. 2. when bcr1.a6pcm = 0, high-z. 3. when bcr1.dramtp (2?) 1 101, high-z. 4. when bcr2.porten = 0, high-z. when bcr2.porten = 1, dependent on pctr register. 5. when bcr2.porten = 0, high-z. when bcr2.porten = 1, d31 and d30 only data output.
574 table a.8 pin states (dram/big-endian) 16-bit bus width (area 3) 16-bit bus width (area 2) pin byte access (address 2n) byte access (address 2n + 1) word/ longword access byte access (address 2n) byte access (address 2n + 1) word/ longword access cs6 to cs0 enabled enabled enabled enabled enabled enabled rd r high high high high high high w high high high high high high rd/ wr r high high high high high high w low low low low low low bs enabled enabled enabled enabled enabled enabled ras / ce low low low high high high cas / casll / oe high low low high high high caslh low high low high high high cashl / cas2l high high high high low low cashh / cas2h high high high low high low dqmll/ we0 r high high high high high high w high high high high high high dqmlu/ we1 r high high high high high high w high high high high high high dqmul/ we2 / iciord r high high high high high high w high high high high high high dqmuu/ we3 / iciowr r high high high high high high w high high high high high high md3/ ce2a high-z or high *1 high-z or high *1 high-z or high *1 high-z or high *1 high-z or high *1 high-z or high *1 md4/ ce2b high-z or high *2 high-z or high *2 high-z or high *2 high-z or high *2 high-z or high *2 high-z or high *2 md5/ ras2 high-z or high *3 high-z or high *3 high-z or high *3 low low low cke disabled disabled disabled disabled disabled disabled wait disabled disabled disabled disabled disabled disabled iois16 disabled disabled disabled disabled disabled disabled a25 to a0 address address address address address address d7 to d0 invalid data valid data valid data invalid data valid data valid data d15 to d8 valid data invalid data valid data valid data invalid data valid data
575 table a.8 pin states (dram/big-endian) (cont) 16-bit bus width (area 3) 16-bit bus width (area 2) pin byte access (address 2n) byte access (address 2n + 1) word/ longword access byte access (address 2n) byte access (address 2n + 1) word/ longword access d23 to d16/ port7 to port0 high-z *4 high-z *4 high-z *4 high-z *4 high-z *4 high-z *4 d31 to d24 high-z *5 high-z *5 high-z *5 high-z *5 high-z *5 high-z *5
576 table a.8 pin states (dram/big-endian) (cont) 32-bit bus width pin byte access (address 4n) byte access (address 4n + 1) byte access (address 4n + 2) byte access (address 4n + 3) word access (address 4n) word access (address 4n + 2) longword access cs6 to cs0 enabled enabled enabled enabled enabled enabled enabled rd r high high high high high high high w high high high high high high high rd/ wr r high high high high high high high w low low low low low low low bs enabled enabled enabled enabled enabled enabled enabled ras / ce low low low low low low low cas / casll / oe high high high low high low low caslh high high low high high low low cashl / cas2l high low high high low high low cashh / cas2h low high high high low high low dqmll/ we0 r high high high high high high high w high high high high high high high dqmlu/ we1 r high high high high high high high w high high high high high high high dqmul/ we2 / iciord r high high high high high high high w high high high high high high high dqmuu/ we3 / iciowr r high high high high high high high w high high high high high high high md3/ ce2a high-z or high *1 high-z or high *1 high-z or high *1 high-z or high *1 high-z or high *1 high-z or high *1 high-z or high *1 md4/ ce2b high-z or high *2 high-z or high *2 high-z or high *2 high-z or high *2 high-z or high *2 high-z or high *2 high-z or high *2 md5/ ras2 high-z high-z high-z high-z high-z high-z high-z cke disabled disabled disabled disabled disabled disabled disabled wait disabled disabled disabled disabled disabled disabled disabled iois16 disabled disabled disabled disabled disabled disabled disabled a25 to a0 address address address address address address address d7 to d0 invalid data invalid data invalid data valid data invalid data valid data valid data
577 table a.8 pin states (dram/big-endian) (cont) 32-bit bus width pin byte access (address 4n) byte access (address 4n + 1) byte access (address 4n + 2) byte access (address 4n + 3) word access (address 4n) word access (address 4n + 2) longword access d15 to d8 invalid data invalid data valid data invalid data invalid data valid data valid data d23 to d16/ port7 to port0 invalid data valid data invalid data invalid data valid data invalid data valid data d31 to d24 valid data invalid data invalid data invalid data valid data invalid data valid data notes: 1. when bcr1.a5pcm = 0, high-z. 2. when bcr1.a6pcm = 0, high-z. 3. when bcr1.dramtp (2?) 1 101, high-z. 4. when bcr2.porten = 0, high-z. when bcr2.porten = 1, dependent on pctr register. 5. when bcr2.porten = 0, high-z. when bcr2.porten = 1, d31 and d30 only data output.
578 table a.9 pin states (synchronous dram/little-endian) 32-bit bus width pin byte access (address 4n) byte access (address 4n + 1) byte access (address 4n + 2) byte access (address 4n + 3) word access (address 4n) word access (address 4n + 2) longword access cs6 to cs0 enabled enabled enabled enabled enabled enabled enabled rd r high high high high high high high w high high high high high high high rd/ wr r high high high high high high high w low low low low low low low bs enabled enabled enabled enabled enabled enabled enabled ras / ce low low low low low low low cas / casll / oe low low low low low low low caslh high high high high high high high cashl / cas2l high high high high high high high cashh / cas2h high high high high high high high dqmll/ we0 r low high high high low high low w low high high high low high low dqmlu/ we1 r high low high high low high low w high low high high low high low dqmul/ we2 / iciord r high high low high high low low w high high low high high low low dqmuu/ we3 / iciowr r high high high low high low low w high high high low high low low md3/ ce2a high-z or high *1 high-z or high *1 high-z or high *1 high-z or high *1 high-z or high *1 high-z or high *1 high-z or high *1 md4/ ce2b high-z or high *2 high-z or high *2 high-z or high *2 high-z or high *2 high-z or high *2 high-z or high *2 high-z or high *2 md5/ ras2 high-z high-z high-z high-z high-z high-z high-z cke high *3 high *3 high *3 high *3 high *3 high *3 high *3 wait disabled disabled disabled disabled disabled disabled disabled iois16 disabled disabled disabled disabled disabled disabled disabled a25 to a0 address, command address, command address, command address, command address, command address, command address, command d7 to d0 valid data invalid data invalid data invalid data valid data invalid data valid data
579 table a.9 pin states (synchronous dram/little-endian) (cont) 32-bit bus width pin byte access (address 4n) byte access (address 4n + 1) byte access (address 4n + 2) byte access (address 4n + 3) word access (address 4n) word access (address 4n + 2) longword access d15 to d8 invalid data valid data invalid data invalid data valid data invalid data valid data d23 to d16/ port7 to port0 invalid data invalid data valid data invalid data invalid data valid data valid data d31 to d24 invalid data invalid data invalid data valid data invalid data valid data valid data notes: 1. when bcr1.a5pcm = 0, high-z. 2. when bcr1.a6pcm = 0, high-z. 3. normally high. low in self-refreshing.
580 table a.10 pin states (synchronous dram/big-endian) 32-bit bus width pin byte access (address 4n) byte access (address 4n + 1) byte access (address 4n + 2) byte access (address 4n + 3) word access (address 4n) word access (address 4n + 2) longword access cs6 to cs0 enabled enabled enabled enabled enabled enabled enabled rd r high high high high high high high w high high high high high high high rd/ wr r high high high high high high high w low low low low low low low bs enabled enabled enabled enabled enabled enabled enabled ras / ce low low low low low low low cas / casll / oe low low low low low low low caslh high high high high high high high cashl / cas2l high high high high high high high cashh / cas2h high high high high high high high dqmll/ we0 r high high high low high low low w high high high low high low low dqmlu/ we1 r high high low high high low low w high high low high high low low dqmul/ we2 / iciord r high low high high low high low w high low high high low high low dqmuu/ we3 / iciowr r low high high high low high low w low high high high low high low md3/ ce2a high-z or high *1 high-z or high *1 high-z or high *1 high-z or high *1 high-z or high *1 high-z or high *1 high-z or high *1 md4/ ce2b high-z or high *2 high-z or high *2 high-z or high *2 high-z or high *2 high-z or high *2 high-z or high *2 high-z or high *2 md5/ ras2 high-z high-z high-z high-z high-z high-z high-z cke high *3 high *3 high *3 high *3 high *3 high *3 high *3 wait disabled disabled disabled disabled disabled disabled disabled iois16 disabled disabled disabled disabled disabled disabled disabled a25 to a0 address, command address, command address, command address, command address, command address, command address, command d7 to d0 invalid data invalid data invalid data valid data invalid data valid data valid data
581 table a.10 pin states (synchronous dram/big-endian) (cont) 32-bit bus width pin byte access (address 4n) byte access (address 4n + 1) byte access (address 4n + 2) byte access (address 4n + 3) word access (address 4n) word access (address 4n + 2) longword access d15 to d8 invalid data invalid data valid data invalid data invalid data valid data valid data d23 to d16/ port7 to port0 invalid data valid data invalid data invalid data valid data invalid data valid data d31 to d24 valid data invalid data invalid data invalid data valid data invalid data valid data notes: 1. when bcr1.a5pcm = 0, high-z. 2. when bcr1.a6pcm = 0, high-z. 3. normally high. low in self-refreshing.
582 table a.11 pin states (pseudo-sram/little-endian) 16-bit bus width pin byte access (address 2n) byte access (address 2n + 1) word/longword access cs6 to cs0 enabled enabled enabled rd r high high high w high high high rd/ wr r high high high w low low low bs enabled enabled enabled ras / ce low low low cas / casll / oe low low low caslh high high high cashl / cas2l high high high cashh / cas2h high high high dqmll/ we0 r high high high w low high low dqmlu/ we1 r high high high w high low low dqmul/ we2 / iciord r high high high w high high high dqmuu/ we3 / iciowr r high high high w high high high md3/ ce2a high-z or high *1 high-z or high *1 high-z or high *1 md4/ ce2b high-z or high *2 high-z or high *2 high-z or high *2 md5/ ras2 high-z high-z high-z cke disabled disabled disabled wait disabled disabled disabled iois16 disabled disabled disabled a25 to a0 address address address d7 to d0 valid data invalid data valid data d15 to d8 invalid data valid data valid data d23 to d16/ port7 to port0 high-z *3 high-z *3 high-z *3 d31 to d24 high-z *4 high-z *4 high-z *4
583 table a.11 pin states (pseudo-sram/little-endian) (cont) 32-bit bus width pin byte access (address 4n) byte access (address 4n + 1) byte access (address 4n + 2) byte access (address 4n + 3) word access (address 4n) word access (address 4n + 2) longword access cs6 to cs0 enabled enabled enabled enabled enabled enabled enabled rd r high high high high high high high w high high high high high high high rd/ wr r high high high high high high high w low low low low low low low bs enabled enabled enabled enabled enabled enabled enabled ras / ce low low low low low low low cas / casll / oe low low low low low low low caslh high high high high high high high cashl / cas2l high high high high high high high cashh / cas2h high high high high high high high dqmll/ we0 r high high high high high high high w low high high high low high low dqmlu/ we1 r high high high high high high high w high low high high low high low dqmul/ we2 / iciord r high high high high high high high w high high low high high low low dqmuu/ we3 / iciowr r high high high high high high high w high high high low high low low md3/ ce2a high-z or high *1 high-z or high *1 high-z or high *1 high-z or high *1 high-z or high *1 high-z or high *1 high-z or high *1 md4/ ce2b high-z or high *2 high-z or high *2 high-z or high *2 high-z or high *2 high-z or high *2 high-z or high *2 high-z or high *2 md5/ ras2 high-z high-z high-z high-z high-z high-z high-z cke disabled disabled disabled disabled disabled disabled disabled wait disabled disabled disabled disabled disabled disabled disabled iois16 disabled disabled disabled disabled disabled disabled disabled a25 to a0 address address address address address address address d7 to d0 valid data invalid data invalid data invalid data valid data invalid data valid data
584 table a.11 pin states (pseudo-sram/little-endian) (cont) 32-bit bus width pin byte access (address 4n) byte access (address 4n + 1) byte access (address 4n + 2) byte access (address 4n + 3) word access (address 4n) word access (address 4n + 2) longword access d15 to d8 invalid data valid data invalid data invalid data valid data invalid data valid data d23 to d16/ port7 to port0 invalid data invalid data valid data invalid data invalid data valid data valid data d31 to d24 invalid data invalid data invalid data valid data invalid data valid data valid data notes: 1. when bcr1.a5pcm = 0, high-z. 2. when bcr1.a6pcm = 0, high-z. 3. when bcr2.porten = 0, high-z. when bcr2.porten = 1, dependent on pctr register. 4. when bcr2.porten = 0, high-z. when bcr2.porten = 1, d31 and d30 only data output.
585 table a.12 pin states (pseudo-sram/big-endian) 16-bit bus width pin byte access (address 2n) byte access (address 2n + 1) word/longword access cs6 to cs0 enabled enabled enabled rd r high high high w high high high rd/ wr r high high high w low low low bs enabled enabled enabled ras / ce low low low cas / casll / oe low low low caslh high high high cashl / cas2l high high high cashh / cas2h high high high dqmll/ we0 r high high high w high low low dqmlu/ we1 r high high high w low high low dqmul/ we2 / iciord r high high high w high high high dqmuu/ we3 / iciowr r high high high w high high high md3/ ce2a high-z or high *1 high-z or high *1 high-z or high *1 md4/ ce2b high-z or high *2 high-z or high *2 high-z or high *2 md5/ ras2 high-z high-z high-z cke disabled disabled disabled wait disabled disabled disabled iois16 disabled disabled disabled a25 to a0 address address address d7 to d0 invalid data valid data valid data d15 to d8 valid data invalid data valid data d23 to d16/ port7 to port0 high-z *3 high-z *3 high-z *3 d31 to d24 high-z *4 high-z *4 high-z *4
586 table a.12 pin states (pseudo-sram/big-endian) (cont) 32-bit bus width pin byte access (address 4n) byte access (address 4n + 1) byte access (address 4n + 2) byte access (address 4n + 3) word access (address 4n) word access (address 4n + 2) longword access cs6 to cs0 enabled enabled enabled enabled enabled enabled enabled rd r high high high high high high high w high high high high high high high rd/ wr r high high high high high high high w low low low low low low low bs enabled enabled enabled enabled enabled enabled enabled ras / ce low low low low low low low cas / casll / oe low low low low low low low caslh high high high high high high high cashl / cas2l high high high high high high high cashh / cas2h high high high high high high high dqmll/ we0 r high high high high high high high w high high high low high low low dqmlu/ we1 r high high high high high high high w high high low high high low low dqmul/ we2 / iciord r high high high high high high high w high low high high low high low dqmuu/ we3 / iciowr r high high high high high high high w low high high high low high low md3/ ce2a high-z or high *1 high-z or high *1 high-z or high *1 high-z or high *1 high-z or high *1 high-z or high *1 high-z or high *1 md4/ ce2b high-z or high *2 high-z or high *2 high-z or high *2 high-z or high *2 high-z or high *2 high-z or high *2 high-z or high *2 md5/ ras2 high-z high-z high-z high-z high-z high-z high-z cke disabled disabled disabled disabled disabled disabled disabled wait disabled disabled disabled disabled disabled disabled disabled iois16 disabled disabled disabled disabled disabled disabled disabled a25 to a0 address address address address address address address d7 to d0 invalid data invalid data invalid data valid data invalid data valid data valid data
587 table a.12 pin states (pseudo-sram/big-endian) (cont) 32-bit bus width pin byte access (address 4n) byte access (address 4n + 1) byte access (address 4n + 2) byte access (address 4n + 3) word access (address 4n) word access (address 4n + 2) longword access d15 to d8 invalid data invalid data valid data invalid data invalid data valid data valid data d23 to d16/ port7 to port0 invalid data valid data invalid data invalid data valid data invalid data valid data d31 to d24 valid data invalid data invalid data invalid data valid data invalid data valid data notes: 1. when bcr1.a5pcm = 0, high-z. 2. when bcr1.a6pcm = 0, high-z. 3. when bcr2.porten = 0, high-z. when bcr2.porten = 1, dependent on pctr register. 4. when bcr2.porten = 0, high-z. when bcr2.porten = 1, d31 and d30 only data output.
588 table a.13 pin states (pcmcia/little-endian) pcmcia memory interface (area 5) 8-bit bus width 16-bit bus width pin byte/word/long- word access byte access (address 2n) byte access (address 2n + 1) word/longword access cs6 to cs0 enabled enabled high enabled rd r low low low low w high high high high rd/ wr r high high high high w low low low low bs enabled enabled enabled enabled ras / ce high high high high cas / casll / oe high high high high caslh high high high high cashl / cas2l high high high high cashh / cas2h high high high high dqmll/ we0 r high high high high w high high high high dqmlu/ we1 r high high high high w low low low low dqmul/ we2 / iciord r high high high high w high high high high dqmuu/ we3 / iciowr r high high high high w high high high high md3/ ce2a high high low low md4/ ce2b high-z or high *2 high-z or high *2 high-z or high *2 high-z or high *2 md5/ ras2 high-z or high *3 high-z or high *3 high-z or high *3 high-z or high *3 cke disabled disabled disabled disabled wait enabled *4 enabled *4 enabled *4 enabled *4 iois16 disabled disabled disabled disabled a25 to a0 address address address address d7 to d0 valid data valid data invalid data valid data d15 to d8 high-z invalid data valid data valid data d23 to d16/ port7 to port0 high-z *5 high-z *5 high-z *5 high-z *5 d31 to d24 high-z *6 high-z *6 high-z *6 high-z *6
589 table a.13 pin states (pcmcia/little-endian) (cont) pcmcia memory interface (area 6) pcmcia/io interface (area 6) 8-bit bus width 16-bit bus width 8-bit bus width 16-bit bus width pin byte/ word/ long- word access byte access (ad- dress 2n) byte access (ad- dress 2n + 1) word/ long- word access byte/ word/ long- word access byte access (ad- dress 2n) byte access (ad-dress 2n + 1) word/ long- word access cs6 to cs0 enabled enabled high enabled enabled enabled high enabled rd r low low low low high high high high w high high high high high high high high rd/ wr r high high high high high high high high w low low low low low low low low bs enabled enabled enabled enabled enabled enabled enabled enabled ras / ce high high high high high high high high cas / casll / oe high high high high high high high high caslh high high high high high high high high cashl / cas2l high high high high high high high high cashh / cas2h high high high high high high high high dqmll/ we0 r high high high high high high high high w high high high high high high high high dqmlu/ we1 r high high high high high high high high w low low low low high high high high dqmul/ we2 / iciord r high high high high low low low low w high high high high high high high high dqmuu/ we3 / iciowr r high high high high high high high high w high high high high low low low low md3/ ce2a high-z or high *1 high-z or high *1 high-z or high *1 high-z or high *1 high-z or high *1 high-z or high *1 high-z or high *1 high-z or high *1 md4/ ce2b high high low low high high low low md5/ ras2 high-z or high *3 high-z or high *3 high-z or high *3 high-z or high *3 high-z or high *3 high-z or high *3 high-z or high *3 high-z or high *3 cke disabled disabled disabled disabled disabled disabled disabled disabled wait enabled *4 enabled *4 enabled *4 enabled *4 enabled *4 enabled *4 enabled *4 enabled *4 iois16 disabled disabled disabled disabled disabled disabled enabled enabled a25 to a0 address address address address address address address address
590 table a.13 pin states (pcmcia/little-endian) (cont) pcmcia memory interface (area 6) pcmcia/io interface (area 6) 8-bit bus width 16-bit bus width 8-bit bus width 16-bit bus width pin byte/ word/ long- word access byte access (ad- dress 2n) byte access (ad- dress 2n + 1) word/ long- word access byte/ word/ long- word access byte access (ad- dress 2n) byte access (ad-dress 2n + 1) word/ long- word access d7 to d0 valid data valid data invalid data valid data valid data valid data invalid data valid data d15 to d8 high-z invalid data valid data valid data high-z invalid data valid data valid data d23 to d16/ port7 to port0 high-z *5 high-z *5 high-z *5 high-z *5 high-z *5 high-z *5 high-z *5 high-z *5 d31 to d24 high-z *6 high-z *6 high-z *6 high-z *6 high-z *6 high-z *6 high-z *6 high-z *6 notes: 1. when bcr1.a5pcm = 0, high-z. 2. when bcr1.a6pcm = 0, high-z. 3. when bcr1.dramtp (2?) 1 101, high-z. 4. when wcr2 register wait setting is 0, disabled. 5. when bcr2.porten = 0, high-z. when bcr2.porten = 1, dependent on pctr register. 6. when bcr2.porten = 0, high-z. when bcr2.porten = 1, d31 and d30 only data output.
591 table a.14 pin states (pcmcia/big-endian) pcmcia memory interface (area 5) 8-bit bus width 16-bit bus width pin byte/word/long- word access byte access (address 2n) byte access (address 2n + 1) word/longword access cs6 to cs0 enabled enabled high enabled rd r low low low low w high high high high rd/ wr r high high high high w low low low low bs enabled enabled enabled enabled ras / ce high high high high cas / casll / oe high high high high caslh high high high high cashl / cas2l high high high high cashh / cas2h high high high high dqmll/ we0 r high high high high w high high high high dqmlu/ we1 r high high high high w low low low low dqmul/ we2 / iciord r high high high high w high high high high dqmuu/ we3 / iciowr r high high high high w high high high high md3/ ce2a high high low low md4/ ce2b high-z or high *2 high-z or high *2 high-z or high *2 high-z or high *2 md5/ ras2 high-z or high *3 high-z or high *3 high-z or high *3 high-z or high *3 cke disabled disabled disabled disabled wait enabled *4 enabled *4 enabled *4 enabled *4 iois16 disabled disabled disabled disabled a25 to a0 address address address address d7 to d0 valid data invalid data valid data valid data d15 to d8 high-z valid data invalid data valid data d23 to d16/ port7 to port0 high-z *5 high-z *5 high-z *5 high-z *5 d31 to d24 high-z *6 high-z *6 high-z *6 high-z *6
592 table a.14 pin states (pcmcia/big-endian) (cont) pcmcia memory interface (area 6) pcmcia/io interface (area 6) 8-bit bus width 16-bit bus width 8-bit bus width 16-bit bus width pin byte/ word/ long- word access byte access (ad- dress 2n) byte access (ad- dress 2n + 1) word/ long- word access byte/ word/ long- word access byte access (ad- dress 2n) byte access (ad- dress 2n + 1) word/ long- word access cs6 to cs0 enabled enabled high enabled enabled enabled high enabled rd r low low low low high high high high w high high high high high high high high rd/ wr r high high high high high high high high w low low low low low low low low bs enabled enabled enabled enabled enabled enabled enabled enabled ras / ce high high high high high high high high cas / casll / oe high high high high high high high high caslh high high high high high high high high cashl / cas2l high high high high high high high high cashh / cas2h high high high high high high high high dqmll/ we0 r high high high high high high high high w high high high high high high high high dqmlu/ we1 r high high high high high high high high w low low low low high high high high dqmul/ we2 / iciord r high high high high low low low low w high high high high high high high high dqmuu/ we3 / iciowr r high high high high high high high high w high high high high low low low low md3/ ce2a high-z or high *1 high-z or high *1 high-z or high *1 high-z or high *1 high-z or high *1 high-z or high *1 high-z or high *1 high-z or high *1 md4/ ce2b high high low low high high low low md5/ ras2 high-z or high *3 high-z or high *3 high-z or high *3 high-z or high *3 high-z or high *3 high-z or high *3 high-z or high *3 high-z or high *3 cke disabled disabled disabled disabled disabled disabled disabled disabled wait enabled *4 enabled *4 enabled *4 enabled *4 enabled *4 enabled *4 enabled *4 enabled *4 iois16 disabled disabled disabled disabled disabled disabled enabled enabled a25 to a0 address address address address address address address address
593 table a.14 pin states (pcmcia/big-endian) (cont) pcmcia memory interface (area 6) pcmcia/io interface (area 6) 8-bit bus width 16-bit bus width 8-bit bus width 16-bit bus width pin byte/ word/ long- word access byte access (ad- dress 2n) byte access (ad- dress 2n + 1) word/ long- word access byte/ word/ long- word access byte access (ad- dress 2n) byte access (ad- dress 2n + 1) word/ long- word access d7 to d0 valid data invalid data valid data valid data valid data invalid data valid data valid data d15 to d8 high-z valid data invalid data valid data high-z valid data invalid data valid data d23 to d16/ port7 to port0 high-z *5 high-z *5 high-z *5 high-z *5 high-z *5 high-z *5 high-z *5 high-z *5 d31 to d24 high-z *6 high-z *6 high-z *6 high-z *6 high-z *6 high-z *6 high-z *6 high-z *6 notes: 1. when bcr1.a5pcm = 0, high-z. 2. when bcr1.a6pcm = 0, high-z. 3. when bcr1.dramtp (2?) 1 101, high-z. 4. when wcr2 register wait setting is 0, disabled. 5. when bcr2.porten = 0, high-z. when bcr2.porten = 1, dependent on pctr register. 6. when bcr2.porten = 0, high-z. when bcr2.porten = 1, d31 and d30 only data output.
594 appendix b control registers b . 1 register address map the address map of memory-mapped control registers is shown in table b-1. the following module abbreviations are used. mmu: memory management unit ubc: user break controller cpg: clock pulse generator bsc: bus state controller rtc: realtime clock intc: interrupt controller tmu: timer unit sci: serial communication interface controller cac: cache the bus column shows the internal bus to which the control register is connected. s: system bus, to which the cpu, cache, tlb, multiplier, and ubc are connected. c: cache bus, to which the bsc and cache are connected. p: peripheral bus, to which the bsc and peripheral modules (rtc, intc, tmu, and sci) are connected. the size column shows the register size in bits. the access size column shows the size used when the control register is accessed (read or written). if a size other than that indicated is used in an access, the result will be incorrect.
595 table b.1 memory-mapped control register address map register abbreviation module bus address size acces s size page table entry high register pteh mmu s h'fffffff0 32 32 page table entry low register ptel mmu s h'fffffff4 32 32 translation table page register ttb mmu s h'fffffff8 32 32 tlb exception address register tea mmu s h'fffffffc 32 32 mmu control register mmucr mmu s h'ffffffe0 32 32 break asid register a basra ubc s h'ffffffe4 8 8 break asid register b basrb ubc s h'ffffffe8 8 8 cache control register ccr cac s h'ffffffec 32 32 trapa exception register tra intc s h'ffffffd0 32 32 exception event register expevt intc s h'ffffffd4 32 32 interrupt event register intevt intc s h'ffffffd8 32 32 break address register a bara ubc s h'ffffffb0 32 32 break address mask register a bamra ubc s h'ffffffb4 8 8 break bus cycle register a bbra ubc s h'ffffffb8 16 16 break address register b barb ubc s h'ffffffa0 32 32 break address mask register b bamrb ubc s h'ffffffa4 8 8 break bus cycle register b bbrb ubc s h'ffffffa8 16 16 break data register b bdrb ubc s h'ffffff90 32 32 break data mask register b bdmrb ubc s h'ffffff94 32 32 break control register brcr ubc s h'ffffff98 16 16 frequency control register frqcr cpg s h'ffffff80 16 16 standby control register stbcr cpg s h'ffffff82 8 8 watchdog timer counter wtcnt cpg s h'ffffff84 8 r: 8, w: 16 watchdog timer control/status register wtcsr cpg s h'ffffff86 8 r: 8, w: 16 bus control register 1 bcr1 bsc c h'ffffff60 16 16 bus control register 2 bcr2 bsc c h'ffffff62 16 16
596 table b.1 memory-mapped control register address map (cont) register abbreviation module bus address size acces s size wait state control register 1 wcr1 bsc c h'ffffff64 16 16 wait state control register 2 wcr2 bsc c h'ffffff66 16 16 individual memory control register mcr bsc c h'ffffff68 16 16 dram control register dcr bsc c h'ffffff6a 16 16 pcmcia control register pcr bsc c h'ffffff6c 16 16 refresh timer control/status register rtcsr bsc c h'ffffff6e 16 16 refresh timer counter rtcnt bsc c h'ffffff70 16 16 refresh timer constant counter rtcor bsc c h'ffffff72 16 16 refresh count register rfcr bsc c h'ffffff74 16 16 port control register pctr bsc c h'ffffff76 16 16 port data register pdtr bsc c h'ffffff78 8 8 serial port register scsptr sci p h'ffffff7c 8 8 sdram mode register sdmr bsc c h'ffffd000 8 8 64 hz counter r64cnt rtc p h'fffffec0 8 8 second counter rseccnt rtc p h'fffffec2 8 8 minute counter rmincnt rtc p h'fffffec4 8 8 hour counter rhrcnt rtc p h'fffffec6 8 8 day-of-week counter rwkcnt rtc p h'fffffec8 8 8 day counter rdaycnt rtc p h'fffffeca 8 8 month counter rmoncnt rtc p h'fffffecc 8 8 year counter ryrcnt rtc p h'fffffece 8 8 second alarm register rsecar rtc p h'fffffed0 8 8 minute alarm register rminar rtc p h'fffffed2 8 8 hour alarm register rhrar rtc p h'fffffed4 8 8 day-of-week alarm register rwkar rtc p h'fffffed6 8 8 day alarm register rdayar rtc p h'fffffed8 8 8 month alarm register rmonar rtc p h'fffffeda 8 8 rtc control register 1 rcr1 rtc p h'fffffedc 8 8 rtc control register 2 rcr2 rtc p h'fffffede 8 8
597 table b.1 memory-mapped control register address map (cont) register abbreviation module bus address size acces s size interrupt control register icr intc p h'fffffee0 16 16 interrupt priority level setting register a ipra intc p h'fffffee2 16 16 interrupt priority level setting register b iprb intc p h'fffffee4 16 16 timer output control register tocr tmu p h'fffffe90 8 8 timer start register tstr tmu p h'fffffe92 8 8 timer constant register 0 tcor0 tmu p h'fffffe94 32 32 timer counter 0 tcnt0 tmu p h'fffffe98 32 32 timer control register 0 tcr0 tmu p h'fffffe9c 16 16 timer constant register 1 tcor1 tmu p h'fffffea0 32 32 timer counter 1 tcnt1 tmu p h'fffffea4 32 32 timer control register 1 tcr1 tmu p h'fffffea8 16 16 timer constant register 2 tcor2 tmu p h'fffffeac 32 32 timer counter 2 tcnt2 tmu p h'fffffeb0 32 32 timer control register 2 tcr2 tmu p h'fffffeb4 16 16 input capture register 2 tcpr2 tmu p h'fffffeb8 32 32 serial mode register scsmr sci p h'fffffe80 8 8 bit rate register scbrr sci p h'fffffe82 8 8 serial control register scscr sci p h'fffffe84 8 8 transmit data register sctdr sci p h'fffffe86 8 8 serial status register scssr sci p h'fffffe88 8 8 receive data register scrdr sci p h'fffffe8a 8 8 smartcard mode register scscmr sci p h'fffffe8c 8 8
598 b . 2 register bit list a register bit list is shown in table b.2 table b.2 register bit list abbreviation bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 module sdmr bsc scsmr c/ a chr pe o/ e stop mp cks1 cks0 sci scbrr sci scscr tie rie te re mpie teie cke1 cke0 sci sctsr sci sctdr sci scssr tdre rdrf orer fer per tend mpb mpbt sci scrsr sci scrdr sci scscmr sdir sinv smif sci tocr tcoe tmu tstr str2 str1 str0 tmu tcor0 tmu tcnt0 tmu tcr0 ?nftmu unie ckeg1 ckeg0 tpsc2 tpsc1 tpsc0 tcor1 tmu tcnt1 tmu
599 table b.2 register bit list (cont) abbreviation bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 module tcr1 ?nftmu unie ckeg1 ckeg0 tpsc2 tpsc1 tpsc0 tcor2 tmu tcnt2 tmu tcr2 icpf unf tmu icpe1 icpe0 unie ckeg1 ckeg0 tpsc2 tpsc1 tpsc0 tcpr2 tmu r64cnt 1hz 2hz 4hz 8hz 16hz 32hz 64hz rtc rseccnt 10 seconds10 seconds10 seconds1 second 1 second 1 second 1 second rtc rmincnt 10 minutes 10 minutes 10 minutes 1 minute 1 minute 1 minute 1 minute rtc rhrcnt 10 hours 10 hours 1 hours 1 hour 1 hour 1 hour rtc rwkcnt day of week day of week day of week rtc rdaycnt 10 days 10 days 1 day 1 day 1 day 1 day rtc rmoncnt 10 months 1 month 1 month 1 month 1 month rtc ryrcnt 10 years 10 years 10 years 10 years 1 year 1 year 1 year 1 year rtc rsecar enb 10 seconds10 seconds10 seconds1 second 1 second 1 second 1 second rtc rminar enb 10 minutes 10 minutes 10 minutes 1 minute 1 minute 1 minute 1 minute rtc rhrar enb 10 hours 10 hours 1 hour 1 hour 1 hour 1 hour rtc rwkar enb day of week day of week day of week rtc rdayar enb 10 days 10 days 1 day 1 day 1 day 1 day rtc rmonar enb 10 months 1 month 1 month 1 month 1 month rtc
600 table b.2 register bit list (cont) abbreviation bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 module rcr1 cf cie aie af rtc rcr2 pef pes2 pes1 pes0 rtcen adj reset start rtc icr nmil nmie intc ipra tmu0 tmu0 tmu0 tmu0 tmu1 tmu1 tmu1 tmu1 intc tmu2 tmu2 tmu2 tmu2 rtc rtc rtc rtc iprb wdt wdt wdt wdt ref ref ref ref intc scisciscisci bcr1 hizmem* hizcnt endian a0bst1 a0bst0 a5bst1 bsc a5bst0 a6bst1 a6bst0 dramtp2 dramtp1 dramtp0 a5pcm a6pcm bcr2 a6sz1 a6sz0 a5sz1 a5sz0 a4sz1 a4sz0 bsc a3sz1 a3sz0 a2sz1 a2sz0 a1sz1 a1sz0 porten wcr1 a6iw1 a6iw0 a5iw1 a5iw0 a4iw1 a4iw0 bsc a3iw1 a3iw0 a2iw1 a2iw0 a1iw1 a1iw0 a0iw1 a0iw0 wcr2 a6w2 a6w1 a6w0 a5w2 a5w1 a5w0 a4w2 a4w1 bsc a4w0 a3w1 a3w0 a1-2w1 a1-2w0 a0w2 a0w1 a0w0 mcr tpc1 tpc0 rcd1 rcd0 trwl1 trwl0 tras1 tras0 bsc be sz amx1 amx0 rfsh rmode edomode dcr tpc1 tpc0 rcd1 rcd0 tras1 tras0 bsc be amx1 amx0 rfsh rmode pcr bsc a5ted1 a5ted0 a6ted1 a6ted0 a5teh1 a5teh0 a6teh1 a6teh0 rtcsr bsc cmf cmie cks2 cks1 cks0 ovf ovie lmts rtcnt bsc rtcor bsc rfcr bsc pctr pb7pup pb7io pb6pup pb6io pb5pup pb5io pb4pup pb4io i/o pb3pup pb3io pb2pup pb2io pb1pup pb1io pb0pup pb0io pdtr pb7dt pb6dt pb5dt pb4dt pb3dt pb2dt pb1dt pb0dt i/o scsptr spb1io spb1dt spb0io spb0dt i/o
601 table b.2 register bit list (cont) abbreviation bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 module frqcr stc2 ifc2 pfc2 ckoen cpg pllen pstby stc1 stc0 ifc1 ifc0 pfc1 pfc0 stbcr stby mstp2 mstp1 mstp0 power- down states wtcnt cpg wtcsr tme wt/ it rsts wovf iovf cks2 cks1 cks0 cpg bdrb bdb31 bdb30 bdb29 bdb28 bdb27 bdb26 bdb25 bdb24 ubc bdb23 bdb22 bdb21 bdb20 bdb19 bdb18 bdb17 bdb16 bdb15 bdb14 bdb13 bdb12 bdb11 bdb10 bdb9 bdb8 bdb7 bdb6 bdb5 bdb4 bdb3 bdb2 bdb1 bdb0 bdmrb bdm31 bdm30 bdm29 bdm28 bdm27 bdm26 bdm25 bdm24 ubc bdm23 bdm22 bdm21 bdm20 bdm19 bdm18 bdm17 bdm16 bdm15 bdm14 bdm13 bdm12 bdm11 bdm10 bdm9 bdm8 bdm7 bdm6 bdm5 bdm4 bdm3 bdm2 bdm1 bdm0 brcr cmfa cmfb pcba ubc dbeb pcbb seq barb bab31 bab30 bab29 bab28 bab27 bab26 bab25 bab24 ubc bab23 bab22 bab21 bab20 bab19 bab18 bab17 bab16 bab15 bab14 bab13 bab12 bab11 bab10 bab9 bab8 bab7 bab6 bab5 bab4 bab3 bab2 bab1 bab0 bamrb basmb bamb1 bamb0 ubc bbrb ubc idb1 idb0 rwb1 rwb0 szb1 szb0 bara baa31 baa30 baa29 baa28 baa27 baa26 baa25 baa24 ubc baa23 baa22 baa21 baa20 baa19 baa18 baa17 baa16 baa15 baa14 baa13 baa12 baa11 baa10 baa9 baa8 baa7 baa6 baa5 baa4 baa3 baa2 baa1 baa0 bamra basma bama1 bama0 ubc bbra ubc ida1 ida0 rwa1 rwa0 sza1 sza0
602 table b.2 register bit list (cont) abbreviation bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 module tra ccn expev tccn intevt ccn mmucr ccn ?v rcrc tf ix at basra basa7 basa6 basa5 basa4 basa3 basa2 basa1 basa0 ubc basrb basb7 basb6 basb5 basb4 basb3 basb2 basb1 basb0 ubc ccr ccn ra 0 cf cb wt ce pteh ccn ptel ccn ? prprsz c d sh ttb ccn
603 table b.2 register bit list (cont) abbreviation bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 module tea ccn legend sci: serial communication interface tmu: timer unit rtc: real time clock intc: interrupt controller bsc: bus state controller cpg: clock pulse generator ubc: user break controller ccn: cache controller unit
604 b . 3 register states in reset and power-down states table b.3 register states in reset and power-down states reset states power-down states module register power-on manual standby sleep cpu r0?15 undefined undefined held held mach, macl undefined undefined held held pr undefined undefined held held pc h'a0000000 h'a0000000 held held sr initialized *1 initialized *1 held held ssr undefined undefined held held spc undefined undefined held held gbr undefined undefined held held vbr h'00000000 h'00000000 held held mmu pteh undefined undefined held held ptel undefined undefined held held ttb undefined undefined held held tea undefined undefined held held mmucr initialized* 2 initialized* 2 held held cache ccr h'00000000 h'00000000 held held intc icr h'8000/h'0000 *3 h'8000/h'0000 *3 held held ipra h'0000 h'0000 held held iprb h'0000 h'0000 held held tra undefined undefined held held expevt h'00000000 h'00000020 held held intevt undefined undefined held held ubc bara undefined held held held basra undefined held held held bamra undefined held held held
605 table b.3 register states in reset and power-down states (cont) reset states power-down states module register power-on manual standby sleep ubc bbra h'0000 h'0000 held held barb undefined held held held bamrb undefined held held held basrb undefined held held held bbrb h'0000 h'0000 held held bdmrb undefined held held held bdrb undefined held held held brcr h'0000 h'0000 held held cpg stbcr h'00 held held held frqcr h'0102 *4 held held held wtcnt h'00 *4 runs runs runs wtcsr h'00 *4 runs runs runs bsc bcr1 h'0000 held held held bcr2 h'3ffc held held held wcr1 h'3fff held held held wcr2 h'ffff held held held mcr h'0000 held held held dcr h'0000 held held held pcr h'0000 held held held rtcsr h'0000 runs held runs rtcnt h'0000 runs held runs rtcor h'0000 held held held rfcr h'0000 runs held runs pctr h'0000 held held held pdtr undefined held held held
606 table b.3 register states in reset and power-down states (cont) reset states power-down states module register power-on manual standby sleep tmu tocr h'00 h'00 held held tstr h'00 h'00 initialized/ held *5 held tcor0 h'ffffffff h'ffffffff held held tcnt0 h'ffffffff h'ffffffff held/runs *5 runs tcr0 h'0000 h'0000 held/runs *5 runs tcor1 h'ffffffff h'ffffffff held held tcnt1 h'ffffffff h'ffffffff held/runs *5 runs tcr1 h'0000 h'0000 held/runs *5 runs tcor2 h'ffffffff h'ffffffff held held tcnt2 h'ffffffff h'ffffffff held/runs *5 runs tcr2 h'0000 h'0000 held/runs *5 runs tcpr2 undefined undefined held held rtc r64cnt undefined runs runs runs rseccnt runs runs runs runs rmincnt runs runs runs runs rhrcnt runs runs runs runs rwkcnt runs runs runs runs rdaycnt runs runs runs runs rmoncnt runs runs runs runs ryrcnt runs runs runs runs rsecar held *6 held held held rminar held *6 held held held rhrar held *6 held held held rwkar held *6 held held held rdayar held *6 held held held rmonar held *6 held held held rcr1 h'00 initialized *7 held held rcr2 h'09 initialized *8 held held
607 table b.3 register states in reset and power-down states (cont) reset states power-down states module register power-on manual standby sleep sci scsmr h'00 h'00 h'00 h'00 *10 scbrr h'ff h'ff h'ff h'ff *10 scscr h'00 h'00 h'00 h'00 *10 sctdr h'ff h'ff h'ff h'ff *10 scssr h'84 h'84 h'84 h'84 *10 scrdr h'00 h'00 h'00 h'00 *10 scsptr initialized *9 held held held scscmr initialized *11 initialized *11 initialized *11 initialized *11 notes: 1. md = 1, rb = 1, bl = 1, i3?0 = b'1111 m, q, s, t are undefined. 2. the sv bit is undefined, other bits = 0. 3. h'8000: nmi pin is high / h'0000: nmi pin is low. 4. initialized in a power-on reset via the reset pin. held in a power-on reset via the wdt. 5. depends on the count clock mode. 6. only the enb bit is cleared. 7. cf bit is undefined, other bits = 0. 8. rtcen and start are held, other bits = 0. 9. bits 2 and 0 are undefined, other bits = 0 10. held when sci is operating, initialized when sci is not used. 11. bits 0, 2, and 3 are cleared, other bits are undefined.
608 appendix c delay time variation due to load capacitance a graph (reference data) of the variation in delay time when a load capacitance greater than that stipulated is connected to the sh7708 series?pins. the graph shown in figure c.1 should be taken into consideration if the stipulated capacitance is exceeded in connecting an external device. the graph will not be linear if the connected load capacitance exceeds the range shown in figure c.1. +4.0 ns +3.0 ns +2.0 ns +1.0 ns +0.0 ns +0 pf +25 pf +50 pf load capacitance delay time figure c.1 load capacitance vs. delay time
609 appendix d package dimensions 0.08 0.10 0.5 20 22.0 0.3 108 73 109 72 37 144 1 36 22.0 0.3 1.0 0.5 0.1 1.70 max 1.40 0.10 0.10 0 e 10 ? m 0.17 0.05 0.22 0.05 1.25 0.20 0.04 0.15 0.04 unit: mm dimension including the plating thickness base material dimension figure d.1 package dimensions (fp-144f: sh7708, sh7708s, sh7708r)
610 108 73 136 0 e 8 0.08 0.07 m 18.0 0.2 72 144 109 37 18.0 0.2 0.18 0.05 0.4 1.20 max 1.0 0.5 0.1 16 1.00 0.10 0.05 0.17 0.05 0.16 0.04 0.15 0.04 unit: mm 1.0 dimension including the plating thickness base material dimension figure d.2 package dimensions (tfp-144: sh7708s)
611 sh7708 series hardware manual publication date: 1st edition, november 1996 6th edition, march 1999 published by: electronic devices sales & marketing group semiconductor & integrated circuits group hitachi, ltd. edited by: technical documentation group ul media co., ltd. copyright ? hitachi, ltd., 1996. all rights reserved. printed in japan.


▲Up To Search▲   

 
Price & Availability of HD6417708

All Rights Reserved © IC-ON-LINE 2003 - 2022  

[Add Bookmark] [Contact Us] [Link exchange] [Privacy policy]
Mirror Sites :  [www.datasheet.hk]   [www.maxim4u.com]  [www.ic-on-line.cn] [www.ic-on-line.com] [www.ic-on-line.net] [www.alldatasheet.com.cn] [www.gdcy.com]  [www.gdcy.net]


 . . . . .
  We use cookies to deliver the best possible web experience and assist with our advertising efforts. By continuing to use this site, you consent to the use of cookies. For more information on cookies, please take a look at our Privacy Policy. X